1.將A.txt文件中的內容複製到C.txt文件中
#include<stdio.h>
#include<stdlib.h>
int main() {
FILE *p1,*p2;
char ch;
p1 = fopen("E:\\A.txt","r");
if(!p1) {
printf("open file fail");
exit(0);
}
p2 = fopen("E:\\c.txt","w");
if(!p2) {
printf("open file fail");
exit(0);
}
while(!feof(p1)){
ch = fgetc(p1);
fputc(ch,p2);
}
fclose(p1);
fclose(p2);
}