📄 copy.c
字号:
/这是C语言复制程序的源码,是提升C语言项目工作能力的好方法/
#include <stdio.h>#include <stdlib.h>#include <fcntl.h>#include <sys/types.h>#include <sys/stat.h>#define MAXSIZE 1024char buf[MAXSIZE];int main(int argc, char *argv[]){ int fdest; int fd; int rep; int file; if (argc != 3) { printf("the") } fd = open(argv[2],O_RDONLY); if ((fd < 0 || fd == 0)) { printf("open error or open empty\n"); exit (1); } rep = read(fd, buf, 50); if ((rep < 0) || (rep == 0)) { printf("read error or read empty\n"); exit (1); } fdest = open (argv[1], O_CREAT | O_WRONLY); if ((fdest < 0) || (fdest == 0)) { printf("the file is not exist\n"); exit (1); } file = write (fdest, buf, 50); if ((file < 0)) { printf("operate is not sucess\n"); exit (1); } printf("%s\n",buf);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -