Okay maybe I'm doing this completely wrong, and it does seem like a very basic question. But even using MSDN examples I believe I have it exactly the same. With some slight changes for better error checking. Well here is the code:
Code:
// find all available hard drives
for( i=0 ; i<26 ; i++ )
{
printf("Checking %c drive.\n", i+'A');
// available drive
if( !_chdrive(i) )
{
// start scanning drive
printf("Scanning drive %c.\n", i+'A');
sprintf(path, "%c:\\*", i+'A');
hFind = FindFirstFile(path, &FindFileData);
if( hFind == INVALID_HANDLE_VALUE )
{
switch(GetLastError())
{
case 3: return(NULL); break;
default:
printf("Cannot scan through drive %c. (%d)\n", i+'A', GetLastError());
break;
}
}
else ScanFolder(pfFiles, path, search, hFind, FindFileData);
}
}
Now my problem is this: My program will only try to scan through the D drive (and I don't have a D drive). But will skip over A, C, E, F, etc. all the drive letters that I actually am using. Can anyone tell me why this is? ScanFolder is just a function that is recursively setup to scan through an entire directory for the search criteria with each file. Each time a new folder is found, it will call itself to scan through the new directory. But it doesn't even get that far so I haven't been able to test it.
Thanks,
cyreon