2010/03/22
파일 존재 유무 파악 _access
#include
// Check for existence.
if( (_access( "crt_ACCESS.C", 0 )) != -1 )
{
printf_s( "File crt_ACCESS.C exists.\n" );
// Check for write permission.
// Assume file is read-only.
if( (_access( "crt_ACCESS.C", 2 )) == -1 )
printf_s( "File crt_ACCESS.C does not have write permission.\n" );
}
_access 설명 보기
int _access(
const char *path,
int mode
);
Parameters
path
File or directory path.
mode
Read/write attribute.
Return Value
Each function returns 0 if the file has the given mode. The function returns ?1 if the named file does not exist or does not have the given mode; in this case, errno is set as shown in the following table.
EACCES
Access denied: the file's permission setting does not allow specified access.
ENOENT
File name or path not found.
EINVAL
Invalid parameter.
Remark
mode value Checks file for
00 Existence only
02 Write-only
04 Read-only
06 Read and write
Labels:
_access
,
File Exits Check
,
TistoryOldPost
,
파일 존재 확인
Subscribe to:
Post Comments
(
Atom
)
No comments :
Post a Comment