StudyingUnixInterface/4/fileDirectory/access.c
2020-12-07 12:17:01 +08:00

20 lines
357 B
C

#include <unistd.h>
#include <stdio.h>
int main(void){
if(access("./access.c", R_OK | W_OK) < 0){
printf("access error for acccess.c\n");
}
else {
printf("read and write access OK\n");
}
if(access("./access.c", R_OK | X_OK) < 0){
printf("access error for acccess.c\n");
}
else {
printf("exec access OK\n");
}
return 0;
}