11.07.2015 Views

CrossWorks for ARM User Guide

CrossWorks for ARM User Guide

CrossWorks for ARM User Guide

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

vprintfvsnprintfvsprintfWrite <strong>for</strong>matted text to standard output using a va_listargumentWrite <strong>for</strong>matted text to a string with truncation using a va_listargumentWrite <strong>for</strong>matted text to a string using a va_list argumentFormatted output control stringsThe <strong>for</strong>mat is composed of zero or more directives: ordinary characters (not ‘%’), whichare copied unchanged to the output stream; and conversion specifications, each ofwhich results in fetching zero or more subsequent arguments, converting them, ifapplicable, according to the corresponding conversion specifier, and then writing theresult to the output stream.OverviewEach conversion specification is introduced by the character ‘%’. After the ‘%’, thefollowing appear in sequence:•Zero or more flags (in any order) that modify the meaning of the conversionspecification.•An optional minimum field width. If the converted value has fewer characters thanthe field width, it is padded with spaces (by default) on the left (or right, if the leftadjustment flag has been given) to the field width. The field width takes the <strong>for</strong>mof an asterisk ‘*’ or a decimal integer.•An optional precision that gives the minimum number of digits to appear <strong>for</strong> the‘d’, ‘i’, ‘o’, ‘u’, ‘x’, and ‘X’ conversions, the number of digits to appear after thedecimal-point character <strong>for</strong> ‘e’, ‘E’, ‘f’, and ‘F’ conversions, the maximum numberof significant digits <strong>for</strong> the ‘g’ and ‘G’ conversions, or the maximum number ofbytes to be written <strong>for</strong> s conversions. The precision takes the <strong>for</strong>m of a period ‘.’followed either by an asterisk ‘*’ or by an optional decimal integer; if only theperiod is specified, the precision is taken as zero. If a precision appears with anyother conversion specifier, the behavior is undefined.•An optional length modifier that specifies the size of the argument.•A conversion specifier character that specifies the type of conversion to be applied.As noted above, a field width, or precision, or both, may be indicated by an asterisk. Inthis case, an int argument supplies the field width or precision. The argumentsspecifying field width, or precision, or both, must appear (in that order) be<strong>for</strong>e theargument (if any) to be converted. A negative field width argument is taken as a ‘-’ flagfollowed by a positive field width. A negative precision argument is taken as if theprecision were omitted.Chapter 28 - Input/output functions281

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!