원형
int access(const char *filename, int amode);
헤더
io.h
기능
파일의 존재 여부(exists) 와 읽고 쓸수 있는지에 대해 조사
amode 의 종류
00 파일 존재를 검사
01 실행
02 쓸수 있는지 검사
04 읽을 수 있는지 검사
06 읽고 쓸수 있는지 검사
도스와 다르게 유닉스상에서는 파일읽기 권한이 존재한다. 유의하라!!
리턴값
TRUE : 0 , FALSE : 1 ERROR : 0
참고함수 chmod, open, read
예제
#include <stdio.h>
#include <io.h>
int main(int argc, char *argv[])
{
if(access("c:\\autoexec.bat",0)==0)
printf("autoexec.bat is exist\n");
else
printf("autoexec.bat is not exist");
return 0;
}
int access(const char *filename, int amode);
헤더
io.h
기능
파일의 존재 여부(exists) 와 읽고 쓸수 있는지에 대해 조사
amode 의 종류
00 파일 존재를 검사
01 실행
02 쓸수 있는지 검사
04 읽을 수 있는지 검사
06 읽고 쓸수 있는지 검사
도스와 다르게 유닉스상에서는 파일읽기 권한이 존재한다. 유의하라!!
리턴값
TRUE : 0 , FALSE : 1 ERROR : 0
참고함수 chmod, open, read
예제
#include <stdio.h>
#include <io.h>
int main(int argc, char *argv[])
{
if(access("c:\\autoexec.bat",0)==0)
printf("autoexec.bat is exist\n");
else
printf("autoexec.bat is not exist");
return 0;
}
'Native > C' 카테고리의 다른 글
[레퍼런스] atexit() (0) | 2013.10.02 |
---|---|
[레퍼런스] assert() (0) | 2013.10.02 |
[레퍼런스] abs() (0) | 2013.10.02 |
구조체 배열 파일로 저장하기 (0) | 2013.10.02 |
fseek (0) | 2013.10.02 |