#include <stdio.h>
/*****************
*name:file_cp.c
*author:QG
*time:2015-05-12
*description:
********************/
int main(int arge,char **argv)
{
FILE *fp_in;
FILE *fp_out;
char buf[1024];
int count_read = 0;
int count_write = 0;
//1.open source file
fp_in = fopen(argv[1],"r+");
//2.open destination file
fp_out = fopen(argv[2],"w+");
//read and write
while((count_read = fread(buf,1,1023,fp_in)) > 0)
{
printf("read %d types !\n",count_read);
buf[1023] = '\0';
count_write = fwrite(buf,1,count_read,fp_out);
printf("write %d types!\n",count_write);
}
close(fp_in);
close(fp_out);
return 0;
}
库函数调用 --综合实例(文件copy)
最新推荐文章于 2023-02-19 18:17:11 发布