#include<stdio.h>
#include<process.h>
void main() {
FILE *fp1, *fp2;
char a;
fp1 = fopen("input.txt", "r");
if (fp1 == NULL) {
puts("cannot open this file");
exit(0);
}
fp2 = fopen("output.txt", "w");
if (fp2 == NULL) {
puts("Not able to open this file");
fclose(fp1);
exit(0);
}
do {
a = fgetc(fp1);
fputc(a, fp2);
} while (a != EOF);
fclose(fp1);
fclose(fp2);
getch();
}
我创建了输入文件input.txt和输出文件output.txt,但在运行程序后发现文本并没有被复制。(我尝试使用cmd和notepad直接创建.txt文件,但都无效)