C++ 搜索文件路径
string directory = getenv("DH_ROOT");
list<string> tempXmlList;
#ifdef _DEBUG
#endif
directory.append("\\demo\\config\\");
string configxmlPath = directory;
configxmlPath.append("*.xml");
WIN32_FIND_DATA find_data;
HANDLE hFileSearch = FindFirstFile(configxmlPath.c_str(), &find_data);
if (INVALID_HANDLE_VALUE == hFileSearch)
{
tempXmlList.clear();
}
else
{
// List all the files in the directory with some info about them.
do
{
if (find_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
{
}
else
{
configxmlPath = directory;
configxmlPath.append(find_data.cFileName);
tempXmlList.push_back(configxmlPath);
}
}
while (FindNextFile(hFileSearch, &find_data) != 0);
FindClose(hFileSearch);
}










