zhangyunjnj 发表于 2011-5-12 15:31:12

关于读入TXT数据的问题,求解答!

我是新手啊 想从本地读入txt的数据文件到MSP430里,用的是IAR EW430 程序如下:
#include"io430.h"
#include"stdio.h"
int main( void )
{
// Stop watchdog timer to prevent time out reset
WDTCTL = WDTPW + WDTHOLD;
FILE *pf;
char str;
int i;
for(i=0;i<100;i++) str=0;
pf=fopen("D:\\record.txt","r");
fread(str,100,100,pf);
fclose(pf);
printf("\n%s",str);

return 0;
}

但是编译之后总是提示我三个错误如下:
Error: identifier "FILE" is undefined D:\Backup\我的文档\TEST\main.c 7
Error: identifier "pf" is undefined D:\Backup\我的文档\TEST\main.c 7
Warning: function "fopen" declared implicitly D:\Backup\我的文档\TEST\main.c 11
Warning: function "fread" declared implicitly D:\Backup\我的文档\TEST\main.c 12
Warning: function "fclose" declared implicitly D:\Backup\我的文档\TEST\main.c 13
Error while running C/C++ compiler

我已经包含了stdio.h这个头文件 为什么还说 FILE 没有定义呢?
求高手解答啊!
页: [1]
查看完整版本: 关于读入TXT数据的问题,求解答!