Altera_Forum
Honored Contributor
20 years agoHow write a file to harddisk by nios IDE
I want to write some data to my PC harddisk or save a file to hard disk by NiosII£¬so I write a test program in IDE, but the "test" file cannot be found.
my test program # include "stdio.h" //int main (void) __attribute__ ((weak, alias ("alt_main"))); //int alt_main (void) int main(void) { float f; FILE *fp; f=12.69; fp=fopen("test","wr+"); if(fp==NULL) { printf("cannot open file\n"); return 1; } if(fwrite(&f,sizeof(float),1,fp)!= 1) { printf("file write error\n"); return 1; } fclose(fp); return 0; }