|
我在SOPC中:cpu,sdram,ram,time,jtag_uart;而且:jtag_uart的名字是jtag_uart;
程序:
********************************************************************/
#include<stdio.h>
#include<string.h>
#include "system.h"
#include <stdlib.h>
int main ()
{
char* msg = "Detected the character 't'.\n";
FILE* fp;
char prompt = 0;
printf("Please Enter some characters: \n");
fp = fopen (JTAG_UART_NAME, "w+"); //打开文件进行读和写
if (fp)
{
while (prompt != 'v') // 循环直至接收到 'v
{
prompt = getc(fp); // 从JTAG UART中获取字符
if (prompt == 't')
{ // 如果字符为 't' 打印信息
fwrite (msg, strlen (msg), 1, fp);
}
if (ferror(fp))// 检查错误是否与文件指针一起出现
clearerr(fp);// 如果是,清除它
}
fprintf(fp, "Closing the JTAG UART file handle.\n");
fclose (fp);
}
else
{
printf("Fail to open file...\n");
}
return 0;
}
********************************************************************/
build project后:有以下错
undefined reference to main
undefined reference to fopen
undefined reference to getc
undefined reference to fclose
希望大家能为小弟解答下,在下不胜感激! |
阿莫论坛20周年了!感谢大家的支持与爱护!!
知道什么是神吗?其实神本来也是人,只不过神做了人做不到的事情 所以才成了神。 (头文字D, 杜汶泽)
|