linux open

时间:2023-03-09 14:43:51
linux  open

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

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

ok