c++遍历文件
void search_plugins() { if (!fs::exists(pluginDir) || !fs::is_directory(pluginDir)) { std::cerr << "目录不存在或不是有效目录: " << pluginDir << std::endl; return; } for (const auto& entry : fs::directory_iterator(pluginDir)) { if (entry.is_regular_file() && entry.path().extension() == ".dll") { std::string dllPath = entry.path().string(); std::cout << "找到DLL文件: " << dllPath << std::endl; // 在这里可以加载DLL文件 // LoadLibrary(dllPath.c_str()); // Windows API } } }
浙公网安备 33010602011771号