Nios® V Processor Software Developer Handbook

ID 743810
Date 4/07/2025
Public

Visible to Intel only — GUID: ixm1659428111777

Ixiasoft

Document Table of Contents

7.12.5.3. Emulate ANSI C Functions

If you choose to omit the full implementation of newlib, but you need a limited number of ANSI-style functions, you can implement them easily using UNIX-style functions.

Unbuffered getchar()

/* getchar: unbuffered single character input */
int getchar ( void )
{
  char c;
  return ( read ( 0, &c, 1 ) == 1 ) ? ( unsigned char ) c : EOF;
}