hi!
below, i enumerate through a folder, and when i get the 'no more files' error i try to use the same file handle again to find files from the beggining, after calling FindClose(). but i immediately get the 'no more files' error again. can't i use a same file handle for subsequent file finds? or is there's something i'm missing?
Code:srand( (unsigned)time( NULL )); int begin = rand(); strcat(fpath,"\\*.*"); FNDAGN: int faerr=0; fh = FindFirstFile(fpath, &finfo); if(fh == INVALID_HANDLE_VALUE) { ErrorMSG("blah blah blah"); return 0; }else{ for(int i=0; i<begin; i++) { FindNextFile(fh, &finfo); if(GetLastError()==18) { FindClose(fh); fh = NULL; goto FNDAGN; } }
thanx in advance 4 any help.