#include <stdio.h>
#include <stdlib.h>
int main()
{
FILE *from_fd;
FILE *to_fd;
char ch;
if((from_fd = fopen("from_file","r")) == NULL)
{
printf("\ncannot open from_file\n");
exit(-1);
}
if((to_fd = fopen("to_file","w+")) == NULL)
{
printf("\ncannot open to_file\n");
exit(-1);
}
while((ch = fgetc(from_fd)) != EOF)
{
fputc(ch,to_fd);
}
fclose(from_fd);
fclose(to_fd);
return 0;
}
用带缓存的文件操作实现简单的文件拷贝
最新推荐文章于 2020-09-28 20:46:07 发布