#include <stdlib.h>#include <stdio.h>void main(){ char c; char file1[30],file2[30]; FILE *fpr,*fpw; printf("请输入第1个文件名:\n"); scanf("%s",file1); if ((fpr=fopen(file1,"r"))==NULL) { printf("无法打开文件%s\n",file1); exit(0); } printf("请输入第2个文件名:\n"); scanf("%s",file2); if((fpw=fopen(file2,"w"))==NULL) { printf("无法打开文件%s\n",file2); exit(0); } while((c=fgetc(fpr))!=EOF) fputc(c,fpw); putchar('\n'); while((c=fgetc(fpw))!='C') putchar(c); fclose(fpr); fclose(fpw); putchar('\n');}
添加回答
举报
0/150
提交
取消