Atmel CAVR-4 Manual De Usuario

Descargar
Página de 323
CAVR-4
Part 1. Using the compiler
The DLIB runtime environment
59
Choosing formatters for printf and scanf
To override the default formatter for all the 
printf-
 and 
scanf
-related functions, 
except for 
wprintf
 and 
wscanf
 variants, you simply set the appropriate library 
options. This section describes the different options available.
Note:
If you rebuild the library, it is possible to optimize these functions even further, 
seConfiguration symbols for printf and scanf, page 69
For information about how to choose formatter for the AVR-specific functions 
printf_P
 and 
scanf_P
CHOOSING PRINTF FORMATTER
The 
printf
 function uses a formatter called 
_Printf
. The default version is quite 
large, and provides facilities not required in many embedded applications. To reduce the 
memory consumption, three smaller, alternative versions are also provided in the 
standard C/EC++ library.
The following table summarizes the capabilities of the different formatters:
* Depends on which library configuration is used.
Formatting capabilities
_PrintfFull
_PrintfLarge
_PrintfSmall 
(default)
_PrintfTiny
Basic specifiers c, d, i, o, p, s, u, X, 
x
, and %
Yes
Yes
Yes
Yes
Multibyte support
*
*
*
No
Floating-point specifiers a, and A
Yes
No
No
No
Floating-point specifiers e, E, f, F, g, 
and G
Yes
Yes
No
No
Conversion specifier n
Yes
Yes
No
No
Format flag space, +, -, #, and 0
Yes
Yes
Yes
No
Length modifiers h, l, L, s, t, and Z Yes
Yes
Yes
No
Field width and precision, including * Yes
Yes
Yes
No
long long
 support
Yes
Yes
No
No
Table 17: Formatters for printf