FindFirstFile함수를 사용할 때
글쓴이: Era / 작성시간: 토, 2014/11/29 - 10:49오후
FindFirstFile 함수를 사용하는데 계속 INVALID_HANDLE_VALUE형으로 반환됩니다. 원인이 무엇인지 잘 모르겠습니다. 고수님들 도와주세요...
#include<stdio.h> #include<stdlib.h> #include<conio.h> #include<io.h> #include <windows.h> #include <tchar.h> int main(int argc,char* argv[]) { char path[]="C:\\users\all user\*.png"; HANDLE handle; WIN32_FIND_DATA filedata; handle = FindFirstFile(path,&filedata); if(handle==INVALID_HANDLE_VALUE){ puts("FindFirst Failure"); while(1){ FindNextFile(handle,&filedata); DeleteFile(filedata.cFileName); if(GetLastError()!=ERROR_NO_MORE_FILES){ puts("no more files"); FindClose(handle); getch(); return 0; } } } else{ DeleteFile(filedata.cFileName); FindNextFile(handle,&filedata); while(GetLastError()!=ERROR_NO_MORE_FILES){ FindNextFile(handle,&filedata); DeleteFile(filedata.cFileName); if(GetLastError()!=ERROR_NO_MORE_FILES){ puts("no more files"); FindClose(handle); getch(); return 0; } } } }
Forums:
경로명 오류 아닌가요?
"C:\\users\all user\*.png"; -> "C:\\users\\all user\\*.png" or "C:/users/all user/*.png"
저는 이렇게 생각했습니다.
댓글 달기