菜鸟问题,小弟在使用msp430,想将txt数据,导入单片机,下面的程序一直出错,请各位大侠指教啊~
#include"io430.h"#include"stdio.h"intmain(void){//Stopwatchdogtimertopreventtimeoutre...
#include"io430.h"
#include"stdio.h"
int main( void )
{
// Stop watchdog timer to prevent time out reset
WDTCTL = WDTPW + WDTHOLD;
FILE *pf;
char str[100];
int i;
for(i=0;i<100;i++) str[i]=0;
pf=fopen("D:\\record.txt","r");
fread(str,100,100,pf);
fclose(pf);
printf("\n%s",str);
return 0;
}
但是编译之后总是提示我三个错误如下:
Error[Pe020]: identifier "FILE" is undefined D:\Backup\我的文档\TEST\main.c 7
Error[Pe020]: identifier "pf" is undefined D:\Backup\我的文档\TEST\main.c 7
Warning[Pe223]: function "fopen" declared implicitly D:\Backup\我的文档\TEST\main.c 11
Warning[Pe223]: function "fread" declared implicitly D:\Backup\我的文档\TEST\main.c 12
Warning[Pe223]: function "fclose" declared implicitly D:\Backup\我的文档\TEST\main.c 13
Error while running C/C++ compiler
我已经包含了stdio.h这个头文件 为什么还说 FILE 没有定义呢?
求高手解答啊! 展开
#include"stdio.h"
int main( void )
{
// Stop watchdog timer to prevent time out reset
WDTCTL = WDTPW + WDTHOLD;
FILE *pf;
char str[100];
int i;
for(i=0;i<100;i++) str[i]=0;
pf=fopen("D:\\record.txt","r");
fread(str,100,100,pf);
fclose(pf);
printf("\n%s",str);
return 0;
}
但是编译之后总是提示我三个错误如下:
Error[Pe020]: identifier "FILE" is undefined D:\Backup\我的文档\TEST\main.c 7
Error[Pe020]: identifier "pf" is undefined D:\Backup\我的文档\TEST\main.c 7
Warning[Pe223]: function "fopen" declared implicitly D:\Backup\我的文档\TEST\main.c 11
Warning[Pe223]: function "fread" declared implicitly D:\Backup\我的文档\TEST\main.c 12
Warning[Pe223]: function "fclose" declared implicitly D:\Backup\我的文档\TEST\main.c 13
Error while running C/C++ compiler
我已经包含了stdio.h这个头文件 为什么还说 FILE 没有定义呢?
求高手解答啊! 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询