Hinweis
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, sich anzumelden oder das Verzeichnis zu wechseln.
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, das Verzeichnis zu wechseln.
In a format specification, the first optional field is flags. A flag directive is a character that specifies output justification and output of signs, blanks, leading zeros, decimal points, and octal and hexadecimal prefixes. More than one flag directive may appear in a format specification, and flags can appear in any order.
Flag Characters
Flag |
Meaning |
Default |
|---|---|---|
– |
Left align the result within the given field width. |
Right align. |
+ |
Use a sign (+ or –) to prefix the output value if it is of a signed type. |
Sign appears only for negative signed values (–). |
0 |
If width is prefixed by 0, leading zeros are added until the minimum width is reached. If both 0 and – appear, the 0 is ignored. If 0 is specified as an integer format (i, u, x, X, o, d) and a precision specification is also present—for example, %04.d—the 0 is ignored. |
No padding. |
blank (' ') |
Use a blank to prefix the output value if it is signed and positive. The blank is ignored if both the blank and + flags appear. |
No blank appears. |
# |
When it's used with the o, x, or X format, the # flag uses 0, 0x, or 0X, respectively, to prefix any nonzero output value. |
No blank appears. |
|
When it's used with the e, E, f, a or A format, the # flag forces the output value to contain a decimal point. |
Decimal point appears only if digits follow it. |
|
When it's used with the g or G format, the # flag forces the output value to contain a decimal point and prevents the truncation of trailing zeros. Ignored when used with c, d, i, u, or s. |
Decimal point appears only if digits follow it. Trailing zeros are truncated. |
See Also
Reference
printf, _printf_l, wprintf, _wprintf_l