Target dependencies on low-level functions in the C and C++ libraries

Table 9 shows the dependencies of the higher-level functions on lower-level functions. If you define your own versions of the lower-level functions, you can use the library versions of the higher-level functions directly.

fgetc() uses __FILE, but fputc() uses __FILE and ferror().

Note

You must provide definitions of __stdin and __stdout if you use any of their associated high-level functions. This applies even if your re-implementations of other functions, such as fgetc() and fputc(), do not reference any data stored in __stdin and __stdout.

Table key:

  1. __FILE, the file structure.

  2. __stdin, the standard input object of type __FILE.

  3. __stdout, the standard output object of type __FILE.

  4. fputc(), outputs a character to a file.

  5. ferror(), returns the error status accumulated during file I/O.

  6. fgetc(), gets a character from a file.

  7. fgetwc()

  8. fputwc()

  9. __backspace(), moves the file pointer to the previous character.

  10. __backspacewc().

Table 9. Input/output dependencies

High-level functionLow-level object 
 12345678910
fgetsx---xx----
fgetwsx-----x---
fprintfx--xx-----
fputsx--x------
fputwsx------x--
freadx----x----
fscanfx----x--x-
fwprintfx---x--x--
fwritex--x------
fwscanfx-----x--x
getcharxx---x----
getsxx--xx----
getwcharxx----x---
perrorx-xx------
printfx-xxx-----
putcharx-xx------
putsx-xx------
putwcharx-x----x--
scanfxx---x--x-
vfprintfx--xx-----
vfscanfx----x--x-
vfwprintfx---x--x--
vfwscanfx-----x--x
vprintfx-xxx-----
vscanfxx---x--x-
vwprintfx-x-x--x--
vwscanfxx----x--x
wprintfx-x-x--x--
wscanfxx----x--x

Note

If you choose to re-implement fgetc(), fputc(), and __backspace(), be aware that fopen() and related functions use the ARM layout for the __FILE structure. You might also have to re-implement fopen() and related functions if you define your own version of __FILE.

Show/hideSee also

Copyright © 2010-2011 ARM. All rights reserved.ARM DUI 0475E
Non-ConfidentialID071611