Forum Discussion
Altera_Forum
Honored Contributor
16 years agoTry this:
# include <stdio.h> # include <string.h> int main () { FILE* fp; char prompt = 0; fp = fopen ("/dev/uart1", "r+"); //Open file for reading and writing //replace 'uart1' with device name you have in sopc builder if (fp) { printf("UART Opened Successfully\n"); while (1) { printf("%c", getc(fp)); } } else { printf("Error: Could not open UART\n"); } return 0; } I have made it in quick time, so not sure if this returns any error, but you can modify it as you like. I have not used but you may want to add fclose(fp) to close UART properly at later stage.