例:读文本文件内容并显示 #include <stdio.h> main ( i FILE fp; char ch *filename="out. txt if((fp=fopen(filename, r=NULL) i printf("cannot open filen); exit(0); while((ch=fgetc(p))=EOF) putchar(ch) fclose(fp); 判断文本文件是否结束例:读文本文件内容并显示 #include <stdio.h> main() { FILE *fp; char ch,*filename="out.txt"; if((fp=fopen(filename, "r"))==NULL) { printf("cannot open file\n"); exit(0); } while((ch=fgetc(fp))!=EOF) putchar(ch); fclose(fp); } 判断文本文件是否结束