VMS Help CC, Run-time functions, printf, Optional character *Conan The Librarian (sorry for the slow response - running on an old VAX) |
flags You can use the following flag characters, alone or in any combined order, to modify the conversion specification: ' Requests that a numeric conversion is formatted with the thousands separator character. Only the numbers to the left of the radix character are formatted with the separator character. The character used as a separator and the positioning of the separators are defined in the program's current locale. -(hyphen) Left-justifies the converted output source in its field. + Requests that an explicit sign be present on a signed conversion. If this flag is not specified, the result of a signed conversion begins with a sign only when a negative value is converted. space Prefixes a space to the result of a signed conversion, if the first character of the conversion is not a sign, or if the conversion results in no characters. If you specify both the space and the + flag, the space flag is ignored. # Requests an alternate form conversion. Depending on the conversion specified, different actions will occur. For the o (octal) conversion, the precision is increased to force the first digit to be a 0. For the x (or X) conversion, a nonzero result is prefixed with 0x (or 0X). For e, E, f, g, and G conversions, the result contains a decimal point even at the end of an integer value. For g and G conversions, trailing zeros are not trimmed. For other conversions, the effect of # is undefined. 0 Uses zeros rather than spaces to pad the field width for d, i, o, u, x, X, e, E, f, g, and G conversions. If both the 0 and the - flags are specified, then the 0 flag is ignored. For d, i, o, u, x, and X conversions, if a precision is specified, the 0 flag is ignored. For other conversions, the behavior of the 0 flag is undefined. field width The minimum field width can be designated by a decimal integer constant, or by an output source. To specify an output source, use an asterisk (*) or the sequence *n$, where n refers to the nth output source listed after the format specification. If the converted output source is wider than the minimum field, write it out. If the converted output source is narrower than the minimum width, pad it to make up the field width. Pad with spaces, by default. Pad with zeros if the 0 flag is specified; this does not mean that the width is an octal number. Padding is on the left by default, and on the right if a minus sign is specified. If an asterisk is used for the field width, the corresponding width is given in the output source. period (.) Separates the field width from the precision. precision The precision defines the minimum number of digits to appear for d, i, o, u, x, and X conversions; the number of digits to appear after the decimal-point character for e, E, and f conversions; the maximum number of significant digits for g and G conversions; or the maximum number of characters to be written from a string in an s or S conversion. If a precision appears with any other conversion specifier, the behavior is undefined. Precision can be designated by a decimal integer constant, or by an output source. To specify an output source, use an asterisk (*) or the sequence *n$, where n refers to the nth output source listed after the format specification. If only the period is specified, the precision is taken as 0. h, l, or L An h specifies that a following d, i, o, u, x, or X conversion specifier applies to a short int or unsigned short int argument; an h can also specify that a following n conversion specifier applies to a pointer to a short int argument. An l (lowercase ell) specifies that a following d, i, o, u, x, or X conversion specifier applies to a long int or unsigned long int argument; an l can also specify that a following n conversion specifier applies to a pointer to a long int argument. An L specifies that a following e, E, f, g, or G conversion specifier applies to a long double argument. If an h, l, or L appears with any other conversion specifier, the behavior is undefined. On Compaq C for OpenVMS VAX and Alpha Systems, int values are equivalent to long values.
|