beautypg.com

Zilog EZ80F916 User Manual

Page 375

background image

UM014423-0607

C Standard Library

ZiLOG Developer Studio II

eZ80Acclaim!

®

User Manual

355

printf Conversion Characters

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.

d,i,o,u,x,X

The int argument is converted to signed decimal (d or i), unsigned octal (o),
unsigned decimal (u), or unsigned hexadecimal notation (x or X); the letters
abcdef are used for x conversion and the letters ABCDEF for X conversion. The
precision specifies the minimum number of digits to appear; if the value being
converted can be represented in fewer digits, it is expanded with leading zeros.
The default precision is 1. The result of converting a zero value with a precision of
zero is no characters.

f

The double argument is converted to decimal notation in the style [-]ddd.ddd,
where the number of digits after the decimal point is equal to the precision
specification. If the precision is missing, it is taken as 6; if the precision is
explicitly zero, no decimal point appears. If a decimal point appears, at least one
digit appears before it. The value is rounded to the appropriate number of digits.

e,E

The double argument is converted in the style [-]d.ddde+dd, where there is one
digit before the decimal point and the number of digits after it is equal to the
precision; when the precision is missing, six digits are produced; if the precision is
zero, no decimal point appears. The value is rounded to the appropriate number of
digits. The E conversion character produces a number with E instead of e
introducing the exponent. The exponent always contains at least two digits.
However, if the magnitude to be converted is greater than or equal to lE+100,
additional exponent digits are written as necessary.

g,G

The double argument is converted in style f or e (or in style E in the case of a G
conversion character), with the precision specifying the number of significant
digits. The style used depends on the value converted; style e is used only if the
exponent resulting from the conversion is less than -4 or greater than the
precision. Trailing zeros are removed from the result; a decimal point appears
only if it is followed by a digit.

c

The int argument is converted to an unsigned char, and the resulting character is
written.

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 character, or
until the number of characters indicated by the precision are written. 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 written 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.

This manual is related to the following products: