Chinaunix首页 | 论坛 | 博客
  • 博客访问: 182548
  • 博文数量: 54
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 2018
  • 用 户 组: 普通用户
  • 注册时间: 2013-03-31 23:14
文章存档

2014年(2)

2013年(52)

分类: 嵌入式

2013-08-19 20:13:24

#include
#include
#include
#include
#include
#include


int main(int argc,char *argv[]){//调用:vi a.c; gcc xx.c; ./a.out a.c b.c;完成a.c到b.c的拷贝

int fd1,fd2;
int ret;

fd1=open(argv[1],O_RDONLY);
fd2=open(argv[2],O_CREAT|O_RDWR);

while(1){
int buf[1024];
memset(buf,0,1024);
ret=read(fd1,buf,1024);
write(fd2,buf,ret);
if(ret<1024)
break;
}
close(fd1);
close(fd2);
return 0;
}

阅读(2021) | 评论(0) | 转发(2) |
给主人留下些什么吧!~~