Altera_Forum
Honored Contributor
20 years agoAccesing PC files from UART
Hi everybody,
I am working in a project that requires sending datas stored in an internal register implemented into the FPGA to a file in a PC (W-XP). I think the best way is using the UART (11500 kbs). however, when I try to access into a file in the computer from Nios, just for training, it doesn't work. I always receive the message "Cannot open file". I use the UP3 Education kit. Any idea? Thank you very much. Roberto. ------------------------------------------------------- The code I download to the Nios is written below: # include <stdio.h># include <stddef.h># include <stdlib.h> # define BUF_SIZE (10) int main(void) { FILE* fp; char buffer[BUF_SIZE]; fp=fopen("/prueba/test.txt", "r"); if (fp==NULL) { printf("Cannot open file. \n"); exit(1); } fread (buffer, BUF_SIZE, 1, fp); fclose(fp); return 0; }