7.5.7 Standard I/O functions

Standard I/O functions are as follows.

Table 7.9

Standard I/O Functions

Function/Macro Name

Outline

printf

Write text in specified format to SFR

scanf

Read text in specified format from SFR

snprintf [V1.07 or later]

Write text in specified format to array (C99)

sprintf

Write text in specified format to array

sscanf

Read text in specified format from character string

vprintf

Write text in specified format to SFR

vsnprintf [V1.07 or later]

Write text in specified format to array (C99)

vsprintf

Write text in specified format to array

getchar

Read one character from SFR

gets

Read character string from SFR

putchar

Write one character to SFR

puts

Write character string to SFR

perror

Error processing

 

Specifications are implemented, so that in each function, input from stdin is performed through the getchar function and output to stdout is performed through the putchar function.

To change stdin and stdout, replace the getchar function and putchar function, respectively.

Output to stderr in the perror function is the same as output to stdout, and so it is performed through the putchar function. Note that replacing the putchar function will also change stderr. To change the output destination of stderr to something other than stdout, replace the perror function