📄 fcopy.c
字号:
/*************//name :fcopy.c//author : pyy//date : 2007-10-22***************/#include<unistd.h>#include<sys/types.h>#include<sys/stat.h>#include<fcntl.h>#include<stdlib.h>#include<stdio.h>int main(){ int fdsrc, fddes, nbytes; int flags=O_CREAT | O_TRUNC | O_WRONLY; int z; char buf[20],mysrc[20],mydes[20]; printf(" input your source file: "); scanf("%s",mysrc); printf(" input your target file:"); scanf("%s",mydes); fdsrc = open(mysrc , O_RDONLY); if (fdsrc <0 ) { perror("write des file"); exit(1); } fddes = open(mydes, flags, 0644); if( fddes<0 ) { perror("open des file"); exit(1); } while( ( nbytes = read(fdsrc,buf,20))>0 ) { z = write(fddes,buf,nbytes); if( z < 0) { perror("write des file."); } } /* while */ close(fdsrc); close(fddes); exit(0);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -