Undefined reference to ' fclose ' errors occurred while doing Nios II uart232 experiments.

Source: Internet
Author: User

The procedure is as follows

#include <stdio.h> #include <string.h> #include   "system.h"  int main  () {   char* msg =  "detected the character  ' t '. \ n";  file* fp;   char prompt = 0;  printf ("Please enter some characters:  \n ");  fp = fopen  ("/dev/uart_0 ", " r+ ");  //open file for read and write   if   (FP)   {     while  (prompt !=  ' V ')  //  Loop until receiving   ' V '      {        prompt =  GETC (FP); //  get character         if  from Jtag uart (prompt  ==  ' t ')         {  //  if the character is   ' t '   Print Info         fwrite  (msg, strlen  (msg), &NBSP;1,&NBSP;FP) ;         }        if  (Ferror (FP))//  Check if the error appears with the file pointer              clearerr (FP);//  If yes, clear it      }     fprintf (fp,  "Closing the UART  file handle.\n ");     fclose  (FP);  }  else   {    printf ("fail to open file...\n");   }return 0;}   error is as follows   wrong reason for detailed connection address http://www.altera.com.cn/support/kdb/solutions/rd10152012_873.html

Undefined reference to ' fclose ' errors occurred while doing Nios II uart232 experiments.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.