
May 20th, 2002, 03:30 PM
|
|
Contributing User
|
|
Join Date: Jan 2002
Location: Seattle WA
Posts: 863
  
Time spent in forums: 22 sec
Reputation Power: 13
|
|
I think winbase.h defines these functions.
Code:
WIN32_FIND_DATA fd;
HANDLE hFind = ::FindFirstFile("c:\mydir\*.*", &fd);
if (hFind != INVALID_HANDLE_VALUE) // make sure valid
{
do
{
if (!(fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) // don't care about directories
MyFunction(fd.cFileName);
} while (::FindNextFile(hFind, &fd)); // enumerates contents
::FindClose(hFind);
}
I've only used them in MFC, so the framework may have automatically imported other necessary libraries, etc. Either way, if you look the MSDN with the above functions, I'm sure you'll figure it out. If you need to enumerate through sub-directories too, check the SetCurrentDirectory() function too.
|