Thanks Slacker,
This is the code i compiled:
#include "sys/alt_stdio.h"# include "stdio.h"# include "string.h"# include "system.h"
int main()
{
char* msg = "Detected character\n";
FILE* fp;
char prompt = 0;
printf("Testing begin\n");
fp = fopen ("/dev/uart_0","r+");
if (fp)
{
while (prompt!=0)
{
prompt = getc(fp);
if (prompt=='t')
{
fwrite (msg,strlen(msg),1,fp);
}
}
fprintf(fp,"closing\n");
fclose(fp);
}*/
return 0;
}
In the system library, if the "small C library" is unchecked, the errors are:
/cygdrive/c/altera/91/nios2eds/bin/nios2-gnutools/H-i686-pc-cygwin/bin/../lib/gcc/nios2-elf/3.4.6/../../../../nios2-elf/lib/libc.a(closer.o) In function `_close_r':
/cygdrive/c/altera/91/nios2eds/bin/nios2-gnutools/H-i686-pc-cygwin/bin/../lib/gcc/nios2-elf/3.4.6/../../../../nios2-elf/lib/libc.a(lseekr.o) In function `_lseek_r':
/cygdrive/c/altera/91/nios2eds/bin/nios2-gnutools/H-i686-pc-cygwin/bin/../lib/gcc/nios2-elf/3.4.6/../../../../nios2-elf/lib/libc.a(openr.o) In function `_open_r':
If the "small C library" is checked, the errors are:
undefined reference to `fopen'
undefined reference to `fopen'
undefined reference to `fopen'
Is there any mistakes in my code, or my project configuration?
Thanks in advanced!