열렬히.뛰기

access()

école 42 > pipex > pipex : 시스템 콜 > access()

🔎 access()

c
#include <unistd.h>
int access(const char *pathname, int mode);

파일의 접근 권한 상태를 확인한다.

mode에는 R_OK(read), W_OK(write), X_OK(execute), F_OK(file)가 있다.

반환 값

  • 0 ⇒ 가능 또는 파일이 존재함
  • -1 ⇒ mode 에 대해 하나 이상 거절되었거나 에러가 있음.