I have the following code, and it works fine, but I want it to go through all the directories in the target folder.
This is the code...
Code:
void TestClass::FindFiles(const std::string &directory, const std::string &types)
{
_WIN32_FIND_DATAA* FindFileData = new _WIN32_FIND_DATAA;
HANDLE hFind;
if ( Debug )
printf("Target: %s\n", directory.c_str());
//Find First file
hFind = FindFirstFileA(directory.c_str(), FindFileData);
if ( hFind == INVALID_HANDLE_VALUE )
printf("Invalid File Handle. Error# %d\n", GetLastError());
else
files.push_back((char*)FindFileData->cFileName);
if ( Debug )
printf("Found: %s\n", FindFileData->cFileName);
//Find the next files
while ( FindNextFileA(hFind, FindFileData) != 0 )
{
files.push_back((char*)FindFileData->cFileName);
if ( Debug )
printf("Found: %s\n", FindFileData->cFileName);
}
FindClose(hFind);
delete FindFileData;
}
Thank you for any advice.