大家帮忙看看,为什么我拷贝的目标文件最后总多出来一个字符?
#include <stdio.h>main(int argc,char *argv[])
{
FILE *in,*out;
if (argc!=3)
{
printf("格式错误!copy filename1 filename2");
getch();
exit(0);
}
if ((out=fopen(argv[1],"r"))==NULL)
{
printf("打开源文件出错!");
getch();
exit(0);
}
if ((in=fopen(argv[2],"w"))==NULL)
{
printf("打开目标文件出错!");
getch();
exit(0);
}
while (!feof(out))
{
fputc(fgetc(out),in);
}
fclose(in);
fclose(out);
printf("拷贝文件成功!");
getch();
}