beautypg.com

Zilog EZ80F916 User Manual

Page 374

background image

UM014423-0607

C Standard Library

ZiLOG Developer Studio II

eZ80Acclaim!

®

User Manual

354

A field width or precision, or both, can be indicated by an asterisk * instead of a digit
string. In this case, an int argument supplies the files width or precision. The
arguments specifying field width or precision displays before the argument (if any) to
be converted. A negative field width argument is taken as a - flag followed by a
positive field width. A negative precision argument is taken as if it were missing.

NOTE: For more specific information on the flag characters and conversion characters for the

printf

function, see “printf Flag Characters” on page 354.

Synopsis

#include
int printf(const char *format, ...);

Returns

The number of characters transmitted or a negative value if an output error occurred.

Example

int i=10;
printf("This is %d",i);

NOTE: This function makes a call to hardware-specific functions to get data from the UART. You

must either link to ZSL to provide these hardware-specific functions or provide your own
equivalent functions. See “Run-Time Library” on page 154.

printf Flag Characters

-

The result of the conversion is left-justified within the field.

+

The result of a signed conversion always begins with a plus or a minus sign.

space

If the first character of a signed conversion is not a sign, a space is added before the result.
If the space and + flags both appear, the space flag is ignored

#

The result is to be converted to an ''alternate form''. For c, d, i, s, and u conversions, the
flag has no effect. For o conversion, it increases the precision to force the first digit of the
result to be a zero. For x (or X) conversion, a nonzero result always contains a decimal
point, even if no digits follow the point (normally, a decimal point appears in the result of
these conversions only if a digit follows it). For g and G conversions, trailing zeros are not
removed from the result, as they normally are.

This manual is related to the following products: