Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- #include <errno.h>
- #include <sys/stat.h>
- #include <sys/types.h>
- #define MY_MASK 0777
- int main()
- {
- int temp;
- printf("Default mask: %o\n", MY_MASK & ~022 & MY_MASK);
- temp = umask(0);
- printf("Previous umask = %o\n", temp);
- if ((temp = mkdir("foodir", MY_MASK)) != 0) {
- fprintf(stderr, "ERROR %d: unable to mkdir; %s\n", errno, strerror(errno));
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement