CodingCat
asked on
how to list the files in a directory using CFileFind class?
hi,
I'm trying to list all the .jpg files using CFileFind class in a console program. I put 3 .jpg files in the same directory for testing.
The program returns 3 32-bit integer, which looks like the addresses of something, but not the names of the jpg files. what's wrong with the code?
I'm trying to list all the .jpg files using CFileFind class in a console program. I put 3 .jpg files in the same directory for testing.
The program returns 3 32-bit integer, which looks like the addresses of something, but not the names of the jpg files. what's wrong with the code?
CFileFind finder;
BOOL bWorking = finder.FindFile(_T("*.jpg"), 0);
bWorking ==0? printf("not find \n"): printf("found \n");
while (bWorking)
{
bWorking = finder.FindNextFile();
cout<<(LPCTSTR)(finder.GetFileName()) << endl;
printf("\n"); }
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
What is the rest of your code in that function?
ASKER
o, I put a finder.Close() in the loop which caused the problem. Thanks.
You're most welcome ;o)
ASKER
"Debug assertion Failed" and I have to abort the program.
How to solve that?