Atmel CAVR-4 Manual De Usuario

Descargar
Página de 323
CAVR-4
60
Choosing formatters for printf and scanf
AVR® IAR C/C++ Compiler
Reference Guide
For information about how to fine-tune the formatting capabilities even further, see 
Configuration symbols for printf and scanf, page 69.
 
Specifying print formatter in IAR Embedded Workbench
To specify the 
printf
 formatter in IAR Embedded Workbench, choose 
Project>Options and select the General Options category. Select the appropriate 
option on the Library options page.
Specifying printf formatter from the command line
To use any other variant than the default (
_PrintfSmall
), add one of the following 
lines in the linker command file you are using:
-e_PrintfLarge=_Printf
-e_PrintfSmall=_Printf
-e_PrintfTiny=_Printf
CHOOSING SCANF FORMATTER 
In a similar way to the 
printf
 function, scanf uses a common formatter, called 
_Scanf
. The default version is very large, and provides facilities that are not required 
in many embedded applications. To reduce the memory consumption, two smaller, 
alternative versions are also provided in the standard C/C++ library.
The following table summarizes the capabilities of the different formatters:
* Depends on which library configuration that is used.
Formatting capabilities
_ScanfFull _ScanfLarge
_ScanfSmall 
(default)
Basic specifiers c, d, i, o, p, s, u, X, 
x
, and %
Yes
Yes
Yes
Multibyte support
*
*
*
Floating-point specifiers a, and A
Yes
No
No
Floating-point specifiers e, E, f, F, g, 
and G
Yes
No
No
Conversion specifier n
Yes
No
No
Scan set [ and ]
Yes
Yes
No
Assignment suppressing *
Yes
Yes
No
long long
 support
Yes
No
No
Table 18: Formatters for scanf