StudyingUnixInterface/4/fileDirectory/mkdir.c

19 lines
342 B
C
Raw Permalink Normal View History

2020-12-07 04:17:01 +00:00
#include <sys/stat.h>
#include <unistd.h>
#include <stdio.h>
#define RWXRR S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IROTH
int main(void) {
if(mkdir("/home/eric/test/testmkdir", RWXRR) < 0) {
printf("mkdir error\n");
}
if(rmdir("/home/eric/test/testmkdir") < 0) {
printf("rmdir error\n");
return -1;
}
return 0;
}