StudyingUnixInterface/4/fileDirectory/access.c

20 lines
357 B
C
Raw Normal View History

2020-12-07 04:17:01 +00:00
#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;
}