#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
int main(void)
{
FILE *fp;
char ch;
if((fp=fopen("c:\\c.txt","rt"))==NULL)
{
printf("Cannot open file strike any key exit!");
getch();
exit(1);
}
ch=fgetc(fp);
while (ch!=EOF)
{
putchar(ch);
ch=fgetc(fp);
}
fclose(fp);
return 0;
}//就是这个函数,为什么始终都不能读出来文件...始终都是打印不能打开文件,所以我就把程序简化了一下,结果fp始终都是指向null,不知道为什么
rt不是以只读方式打开么