Problem with using the "fopen" on Nios

Status
Not open for further replies.

simonyoyo

Newbie level 1
Joined
Apr 15, 2003
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
15
Hello,

Have everyone ever used the "fopen" on Nios?
The C code:
void main()
{
FILE *fp;
fp=fopen("a.out","rb");
fclose(fp);
}

The error messages in below:
--------------------
Beginning Build
--------------------

Sources:
jpeg.c

# (*) nios-elf-gcc -I ../inc -I ../../inc -I ../../../inc -g -O2 -m32 jpeg.c -o jpeg.c.o -c
jpeg.c:1089:2: warning: no newline at end of file
jpeg.c: In function 'FINAL_byte':
jpeg.c:526: warning: comparison is always false due to limited range of data type

# (*) nios-elf-ld -e _start -u _start -g -T /usr/altera/excalibur/nios-sdk/bin/nios.ld ../../lib/obj32/nios_jumptostart.o jpeg.c.o -lnios32 -lc -lm -lgcc -lc -lnios32 -L/usr/altera/excalibur/nios-elf/lib/m32/ -L/usr/altera/excalibur/lib/gcc-lib/nios-elf/2.9-nios-010625/m32/ -L../lib -L../../lib -L../inc -L../../inc -L../../../inc -o jpeg.out

/usr/altera/excalibur/nios-elf/lib/m32//libc.a<openr.o>:In function '_open_r':
openr.o<.text+0x14>:undefined reference to '_open'
openr.o<.text+0x16>:undefined reference to '_open'
openr.o<.text+0x18>:undefined reference to '_open'
openr.o<.text+0x1a>:undefined reference to '_open'

### nios-build error: last system call returned256
Died at - line 27.

Please tell me how to do this on Nios. Thanks!!
 

fopen nios

simonyoyo said:
Hello,

Have everyone ever used the "fopen" on Nios?
...

If you write c-code for the Nios, always remember you are writing code for an embedded system. the Nios isn't the next juicy pentium to play games on and surf the internet. no, nios is ment to be used in embedded applications. i recommend you reconsider your approach, cause fopen means you create a file on your harddisk. a small embedded nios system usually doesn't have a harddisk.

although, you CAN create many variables and records if you want.
you can even attach a harddisk if you want, but remember you have to write you're own c-library of low-level-code commands to work with this harddisk.

nios, that's the real world out there kiddo...
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…