umask文件屏蔽字的使用【学习笔记】

 1 #include "apue.h"
 2 #include <fcntl.h>
 3 
 4 #define RWRWRW    (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)
 5 
 6 int main(int argc,char *argv[])
 7 {
 8     umask(0);
 9     if(creat("zbzhuang",RWRWRW) < 0)
10         err_sys("create error for zbzhuang\r\n");
11 
12     umask(S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH);
13     if(creat("caylin",RWRWRW) < 0)
14         err_sys("create error for caylin\r\n");
15 
16     return 0;
17 }
18 ~          

 

posted @ 2017-06-08 16:27  请给我倒杯茶  阅读(352)  评论(0编辑  收藏  举报