p5.6.c
来自「linux程序设计例程」· C语言 代码 · 共 32 行
C
32 行
#include <stdio.h>#include <unistd.h>#include <sys/stat.h>#include <sys/stat.h>#include <fcntl.h>int main(int argc,char* argv[]){ int fd1; if(argc!=2){ printf("Usage: %s filename\n"); return 1; } if((fd1=open(argv[1],O_CREAT | O_RDWR,0777))==-1){ perror("Cannot create the file"); return 1; } close(STDOUT_FILENO); if(dup(fd1)==-1){ perror("Cannot reserved the std out fd"); return 1; } printf("Write the the file\n"); close(fd1); return 0;}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?