beautypg.com

Putchar, Puts, Putchar puts – Zilog Z8F0130 User Manual

Page 479

background image

UM013037-1212

putchar

Zilog Developer Studio II – Z8 Encore!

User Manual

455

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

init_uart

section on page 232.

puts

Writes the string pointed to by s to the serial port and appends a new-line character to the
output. The terminating null character is not written.

Synopsis

#include

int puts(char *s);

Returns

EOF if an error occurs; otherwise, it is a nonnegative value.

Example

int i;

char strp[]="COMPASS";

i=puts(str);

Note: