Study from csdn
1, _access() Function:
if ((_access( filename , 0 )) != -1)
//... file exits
else
//... file does not exit
int _access( const char *path, int mode ); int _waccess( const wchar_t *path, int mode );
Parameters
-
path
-
File or directory path.
-
mode
-
Read/write attribute.
2, CreateFile() Function:
if (INVALID_HANDLE_VALUE != CreateFile(filename, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL))
// file exits
3, GetFileAttributes() Function:
if (GetFileAttributes(filename) != -1)
// file exits
4, FindFirstFile() Function:
WIN32_FIND_DATA FindFileData;
HANDLE hFind;
hFind = FindFirstFile(file, &FindFileData);
if (hFind != INVALID_HANDLE_VALUE)
// file exits