Hi ALL.,
How can I retrive the no. of files and it's name available in a folder.?
Thanks..!
Printable View
Hi ALL.,
How can I retrive the no. of files and it's name available in a folder.?
Thanks..!
Here's a short example that lists all files in the
current working directory. You can modify it easily for
your purpose:
Code:{
CFileFind finder;
char szDir[MAX_PATH+1];
GetCurrentDirectory(MAX_PATH,szDir);
strcat(szDir,"\\*.*");
cout << "Dire=" << szDir << endl;
BOOL bWorking = finder.FindFile(szDir);
while (bWorking)
{
bWorking = finder.FindNextFile();
// Don't list directory names
if(!finder.IsDirectory())
{
cout << (LPCTSTR)finder.GetFilePath() << endl;
}
}
return 0;
}
Take a look at the following FAQs:
Thanks a lot Kochhar & Andreas for yoru replies..
I got it..