Forum Discussion

euem789's avatar
euem789
Icon for New Contributor rankNew Contributor
5 years ago
Solved

file io with NIOS II

Hi all I wrote a code to read the text file for implementing in FPGA board (DE1-SOC) with NIOS II , but when I build the project, the elf file wasn't generated. here's my code ----------...
  • 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