Recursive hard disk search with FindFirstFile & FindNextFile C++

后端 未结 2 834
-上瘾入骨i
-上瘾入骨i 2020-12-04 02:11

I am failing to see where i am going wrong. This current code skips straight to closefile. NOt processing any files, i may just be missing something obvious and it has been

2条回答
  •  失恋的感觉
    2020-12-04 02:56

    Your condition is incorrect, you should compare to to INVALID_HANDLE_VALUE

     if ( hFile != INVALID_HANDLE_VALUE)
    

    Besides you skip the first matching file returned by FindFirstFile, is that what you want?

    Also I believe you need a wildcard c:\\* otherwise it will only match c:\\ itself

    hFile = FindFirstFile("C:\\*", &file);
    

提交回复
热议问题