Shortcut for VC ++ to determine whether a file or folder exists _ access, vc_access
_ Access function
int _access( const char *path, int mode );int _waccess( const wchar_t *path, int mode );
Parameters
-
Path
-
File or directory path.
-
Mode
-
Read/write features.
Return Value
If the file contains a specific mode, each function returns 0. If the function returns-1, the name file does not exist or does not have a specific mode. In this case, the following tableErrnoAs shown in.
-
EACCES
-
Access Denied: The File Permission setting does not allow the specified access permission.
-
ENOENT
-
No file name or path found.
-
EINVAL
-
Invalid parameter.
Remarks
When using files,_ AccessThe function determines whether the specified file or directory exists and has the specified mode value. In use and directory,_ AccessCheck whether the specified directory exists. Only the read and write permissions for all directories in Windows 2000 and later operating systems are available.
Mode Value |
Check the file. |
00 |
Only exist |
02 |
Write-only |
04 |
Read-Only |
06 |
Read and Write |