CARM User's Guide

Discontinued

Stream I/O Routines

RoutineAttributesDescription
getcharreentrantReads and echoes a character using the _getkey and putchar routines.
_getkey Reads a character using the serial interface.
gets Reads and echoes a character string using the getchar routine.
printf Writes formatted data using the putchar routine.
putchar Writes a character using the serial interface.
putsreentrantWrites a character string and newline ('\n') character using the putchar routine.
scanf Reads formatted data using the getchar routine.
sprintf Writes formatted data to a string.
sscanf Reads formatted data from a string.
ungetchar Places a character back into the getchar input buffer.
vprintf Writes formatted data using the putchar function.
vsprintf Writes formatted data to a string.

The stream I/O routines are implemented as functions and are prototyped in the stdio.h include file.

The stream input and output routines allow you to read and write data to and from a user-defined I/O interface. Characters are read using the _getkey routine and are written using the putchar routine. The default _getkey and putchar functions in the library read and write characters using your device's serial interface.

The source code for _getkey and putchar is available in the \KEIL\ARM\LIB folder. You may modify these files and substitute them for the default library routines. The stream functions then perform input and output using your modified _getkey and putchar routines.

To use the existing _getkey and putchar routines, you must first initialize the serial port. If the serial port is not properly initialized, the default stream functions do not function.