program1.c

来自「内含6个Linux平台下的程序」· C语言 代码 · 共 24 行

C
24
字号
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>

#define NBYTES  1
#define SIZE  1
#define ITEMS 1024
#define BUFSIZE 1024

int main(void)
{
char buf[BUFSIZE];
int  n;
int  fd1,fd2;
fd1=open("origin",O_RDONLY);
creat("copyfile1",0660);
fd2=open("copyfile1",O_WRONLY);
while((n=read(fd1,buf,NBYTES))>0)
{
write(fd2,buf,n);
}
return 0;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?