码迷,mamicode.com
首页 > 系统相关 > 详细

linux open

时间:2015-12-08 17:56:25      阅读:204      评论:0      收藏:0      [点我收藏+]

标签:

一直记住不打开文件时候的mode,今天发现原来可以直接用0644这样的八进制数字代替,好开森

#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
int main(){
    umask(0);
    int fd = open ("111",O_WRONLY | O_CREAT , 0644);
    if(fd == -1){
        perror("open file error");
    }
    return 0;
}

ok

linux open

标签:

原文地址:http://www.cnblogs.com/cdwodm/p/5029414.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!