#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdio.h>
int main()
{
int fd;
fd = open("./file1",O_RDWR);
if(fd==-1){
printf("open file1 failed\n");
fd = open("./file1",O_RDWR|O_CREAT,0600);
if(fd>0){
printf("creat file1 successful\n");
}
}
return 0;
}```
Linux文件编程demo2文件打开及创建.c
最新推荐文章于 2025-12-04 16:38:42 发布
1670

被折叠的 条评论
为什么被折叠?



