Forum Discussion
file io with NIOS II
- 5 years ago
Hi, Dong Wook
You are right.
However, there is another way, ie using a character-mode device like UART.
Below example is to write characters to a UART called uart1. You can find the device name (/dev/uart1) in the system.h
#include <stdio.h>
#include <string.h>
int main (void)
{
char* msg = "hello world";
FILE* fp;
fp = fopen ("/dev/uart1", "w");
if (fp!=NULL) { fprintf(fp, "%s",msg); fclose (fp);}
return 0;
}
Thanks.
Eric
Hi, Dong Wook
Thanks for your appraisal, and I noted.
For my recommendation below, you may consider using a HyperTerminal or other tools to transmit character by character from your PC to the target FPGA hardware board. Then you may apply fread() or fscanf() instead in your code to read from your PC to the target FPGA board.
Please let me know if you have question.
Yon can proceed to open a new ticket, welcome.
Again thanks for your appraisal.
Thanks.
Eric