脚本宝典收集整理的这篇文章主要介绍了【C语言程序设计第四版】例12-3代码,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
#include <stdio.h> #include <stdlib.h> int main(void){ FILE *fp1, *fp2; char ch; if ((fp1 = foPEn("F12-2.txt", "r")) == NULL) { PRintf("File open error!n"); exIT(0); } if ((fp2 =fopen("f12-3.txt", "w")) == NULL) { printf("File open error!n"); exit(0); } while (!feof(fp1)) { ch = fgetc(fp1); if (ch!=EOF) { // 只有当ch读取到EOF的时候,feof函数才返回1. fputc(ch, fp2); } } if (fclose(fp1)) { printf("Can not close the file!n"); exit(0); } if (fclose(fp2)) { printf("Can not close the file!n"); exit(0); } return 0; }
以上是脚本宝典为你收集整理的【C语言程序设计第四版】例12-3代码全部内容,希望文章能够帮你解决【C语言程序设计第四版】例12-3代码所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。