#include "stdafx.h"#include "stdio.h"int main(int argc, char* argv[]){FILE*fp,*fp2;fp=fopen("D:\\C\\file5\\file.txt","r");fp2=fopen("D:\\C\\file5\\file2.txt","w");if(fp==NULL)printf("cannot open file");if(fp2==NULL)printf("cannot open file2");char ch;while(!feof(fp)){ch=fgetc(fp);putchar(ch);fputc(ch,fp2);}fclose(fp);fclose(fp2);return 0;}如果while循環(huán)里改為:while(!feof(fp)){putchar(fgetc(fp));fputc(fgetc(fp,fp2);}輸出內(nèi)容file的內(nèi)容:abcdefghijklmnopqrstuvwxyz
- 2 回答
- 0 關(guān)注
- 85 瀏覽
添加回答
舉報
0/150
提交
取消