69,382
社区成员
发帖
与我相关
我的任务
分享
# include <stdio.h>
# include <stdlib.h>
int main(void)
{
FILE *in , *out;
char infile[10] , outfile[10];
printf("请输入目标文件的名字.\n");
scanf("%s",infile);
printf("请输入目的文件的名字.\n");
scanf("%s",outfile);
if((in = fopen(infile,'r')) == NULL)
{
printf("对不起不能打开文件,请检查后重试.\n");
exit(0);
}
if((out = fopen(outfile,"w") == NULL))
{
printf("对不起不能打开文件,请检查后重试.\n");
exit(0);
}
while (!feof(in)) fputc(fgetc(in),out);
/* while(!feof(in))
{
fputc(fgetc(in),out);
}
*/
fclose(in);
fclose(out);
system("pause");
return 0;
}