masvmasv
asked on
FindFirstFile and FindNextFile Example...
Hi...
I need the FindFirstFile and FileNextFile example
Visual C++ Source code...
If you have, send to me.. thanks
I need the FindFirstFile and FileNextFile example
Visual C++ Source code...
If you have, send to me.. thanks
???
Simply use the following:
WIN32_FIND_DATA w32fd;
HANDLE hFind;
hFind = FindFirstFile ( "c:\\yourpath\\*.gif", &w32fd);
if ( INVALID_HANDLE_VALUE == hFind)
{
// error
}
DoSomethingWithFile ( w32fd.cFileName);
while ( FindNextFile ( hFind, &w32fd))
{
DoSomethingWithFile ( w32fd.cFileName);
}
if ( ERROR_NO_MORE_FILES != GetLastError()))
{
// error
}
FindClose ( hFind);
Simply use the following:
WIN32_FIND_DATA w32fd;
HANDLE hFind;
hFind = FindFirstFile ( "c:\\yourpath\\*.gif", &w32fd);
if ( INVALID_HANDLE_VALUE == hFind)
{
// error
}
DoSomethingWithFile ( w32fd.cFileName);
while ( FindNextFile ( hFind, &w32fd))
{
DoSomethingWithFile ( w32fd.cFileName);
}
if ( ERROR_NO_MORE_FILES != GetLastError()))
{
// error
}
FindClose ( hFind);
ASKER
Thanks...
But I need files in all hard disk, subdirectories too..
thanks
But I need files in all hard disk, subdirectories too..
thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
szFileToFind += "\\log*.*";
if(!find.FindFile(szFileTo
return 0;
find.FindNextFile();