文件操作为什么错误
程序代码:# include <stdio.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;
}帮我看看为什么错,错误信息在错误的语句后面。
程序需要读的文件,我的硬盘里是不存在的。
[ 本帖最后由 a9517495424 于 2011-8-6 12:07 编辑 ]









