文件的读写操作
#include "stdafx.h"#include "stdlib.h"
#include "conio.h"
void main()
{
FILE *fp;
char ch;
if ((fp=fopen("D:\\123.text","r"))==NULL)
{printf("can't open the file!\n");
getch();
exit(1);
}
ch=fgetc(fp);
while(ch!=EOF)
{putchar(ch);
ch=fgetc(fp);
}
fclose(fp);
}
这个程序过程应该没什么问题,但是为什么我读文件时读不出来文件内容,内容如下:
91753.195312
263115.437500
275111.218750
280222.812500
352609.656250
370871.250000
411516.718750
497919.218750
538770.812500
597801.500000
648670.187500
649659.500000
798514.250000
827617.375000
1216634.875000
1242110.375000