程序代码:
#include <stdio.h> #include <conio.h> #include <stdlib.h> int main () { FILE *fp; char ch; if ((fp=fopen("d:\\jrzh\\example\\c1.txt","rt")) == NULL) { printf("\nCannot open file strike any key exit!"); getch(); //D:\C编程测试\文件.cpp(9) : error C2065: 'getch' : undeclared identifier exit(1); //D:\C编程测试\文件.cpp(10) : error C2065: 'exit' : undeclared identifier } ch = fgetc(fp); while (ch != EOF) { putchar(ch); ch = fgetc(fp); } fclose(fp); return 0; }
===========深入<----------------->浅出============