Putchar, Synopsis, Returns – Zilog ZUSBOPTS User Manual
Page 461: Example

UM017105-0511
Standard Functions
Zilog Developer Studio II – ZNEO™
User Manual
433
In no case does a nonexistent or small field width cause truncation of a field. If the result
of a conversion is wider than the field width, the field is expanded to contain the conver-
sion result.
putchar
Writes a character to the serial port.
Synopsis
#include
int putchar(int c);
Returns
The character written. If a write error occurs,
putchar
returns EOF.
Example
int i;
charc='a';
i=putchar(c);
The UART must be initialized using the Zilog
init_uart()
function. See the
s
The argument is taken to be a (const char *) pointer to a string. Characters
from the string are written up to, but not including, the terminating null char-
acter, or until the number of characters indicated by the precision are writ-
ten. If the precision is missing it is taken to be arbitrarily large, so all
characters before the first null character are written.
p
The argument is taken to be a (const void) pointer to an object. The value of
the pointer is converted to a sequence of hex digits.
n
The argument is taken to be an (int) pointer to an integer into which is writ-
ten the number of characters written to the output stream so far by this call
to printf. No argument is converted.
%
A % is written. No argument is converted.
Note: