level 1
#include <stdio.h>
int main(void)
{
FILE *fp1,*fp2;
signed char c;
fp1=fopen("a.txt","r"); /*打开源文件*/
fp2=fopen("b.txt","w"); /*打开将写入的文件*/
while ((c=fgetc(fp1))!=EOF) /*将源文件fp1的内容转存(复制)到目标文件fp2中*/
fputc(c,fp2);
fclose(fp1); /*关闭文件*/
fclose(fp2);
return 0;
}
2018年02月28日 07点02分
7
这个可以啊,我运行过了
2018年02月28日 07点02分
@不知者来此 是不是手机太烂了 我又去试了几次 还是一样
2018年02月28日 07点02分
level 13
//这是有效的,你参考吧
#include <stdio.h>
int main() {
signed char c;
FILE *f1 = fopen("a.txt", "rb");
FILE *f2 = fopen("b.txt", "wb");
while ((c = fgetc(f1)) != EOF)
fputc(c, f2);
fclose(f1);
fclose(f2);
return 0;
}
2018年02月28日 07点02分
8
level 13
//你把这个运行一下截个图
#include <stdio.h>
#include <stdlib.h>
int main(void) {
system("cat a.txt");
FILE *fp1, *fp2;
signed char c;
fp1 = fopen("a.txt", "r"); /*打开源文件*/
fp2 = fopen("b.txt", "w"); /*打开将写入的文件*/
while ((c = fgetc(fp1)) != EOF) /*将源文件fp1的内容转存(复制)到目标文件fp2中*/
fputc(c, fp2);
fclose(fp1); /*关闭文件*/
fclose(fp2);
system("cat b.txt");
return 0;
}
2018年02月28日 07点02分
11
改成绝对路径 成了
2018年02月28日 08点02分
level 13
我知道了,这个运行目录不在你的自作用件下,而是在内部的home目录,所以这个a.txt和b.txt你可能要填写完整路径才行,这个问题在cide3是没有的。
2018年02月28日 08点02分
13