Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

swprintf(3c) [hpux man page]

fwprintf(3C)															      fwprintf(3C)

NAME
fwprintf(), wprintf(), swprintf() - print formatted wide-character output SYNOPSIS
DESCRIPTION
The function places output on the named output stream. The function places output on the standard output stream stdout. The function places output followed by the null wide-character in consecutive wide-characters starting at no more than n wide-characters are written, including a terminating null wide-character, which is always added (unless n is zero). Each of these functions converts, formats and prints its arguments under control of the format wide-character string. The format is com- posed of zero or more directives: ordinary wide-characters, which are simply copied to the output stream and conversion specifications, each of which results in the fetching of zero or more arguments. Conversions can be applied to the nth argument after the format in the argument list, rather than to the next unused argument. In this case, the conversion wide-character (see below) is replaced by the sequence where n is a decimal integer in the range 1 through giving the position of the argument in the argument list. This feature provides for the definition of format wide-character strings that select argu- ments in an order appropriate to specific languages (see the section). In format wide-character strings containing the form of conversion specifications, numbered arguments in the argument list can be refer- enced from the format wide-character string as many times as required. In format wide-character strings containing the form of conversion specifications, each argument in the argument list is used exactly once. All forms of the functions allow for the insertion of a language-dependent radix character in the output string, output as a wide-character value. The radix character is defined in the program's locale (category In the POSIX locale, or in a locale where the radix character is not defined, the radix character defaults to a period Each conversion specification is introduced by the wide-character or by the wide-character sequence after which the following appear in sequence: 1. Zero or more flags (in any order), which modify the meaning of the conversion specification. 2. An optional minimum field width. If the converted value has fewer wide-characters than the field width, it will be padded with spaces by default on the left. 3. An optional precision that gives the minimum number of digits to appear for the and conversions. 4. Zero or more of the following optional character specifications: o an optional specifying that a following conversion wide-character applies to a pointer to a type short int argument o an optional specifying that a following or conversion wide-character applies to a type short int or type unsigned short int argument (the argument will have been promoted according to the integral promotions, and its value will be converted to type short int or unsigned short int before printing) o an optional specifying that a following or conversion specifier applies to a signed char or unsigned char argument ( the argument will have been promoted according to the integer promotions, but its value will be converted to short or unsigned short before printing) o an optional specifying that a following conversion specifier applies to a pointer to a signed char argument o an optional specifying that a following or conversion wide-character applies to a type which is the 80-bit IEEE-754 dou- ble-extended type in the architecture o an optional specifying that a following or conversion specifier applies to an intmax_t or uintmax_t argument o an optional specifying that a following conversion specifier applies to a pointer to an intmax_t argument o an optional (ell) specifying that a following conversion wide-character applies to a wint_t argument o an optional (ell) specifying that a following conversion wide-character applies to a wchar_t argument o an optional (ell-ell) specifying that following or conversion specifier applies to a long long or unsigned long long argu- ment o an optional (ell-ell) specifying that following conversion specifier applies to a pointer to a long long argument o an optional specifying that a following or conversion specifier applies to a ptrdiff_t or the corresponding unsigned type argument o an optional specifying that a following conversion specifier applies to a pointer to a ptrdiff_t argument o an optional specifying that a following or conversion specifier applies to a size_t argument or the corresponding signed integer type argument o an optional specifying that a following conversion specifier applies to a pointer to a size_t argument For Itanium(R)-based systems if the optional decimal floating point feature is installed and enabled, the following optional character specifications are allowed: o an optional specifying that a following or conversion specifier applies to a argument. o an optional specifying that a following or conversion specifier applies to a argument. o an optional specifying that a following or conversion specifier applies to a argument. 5. A conversion wide-character that indicates the type of conversion to be applied. A field width, or precision, or both, may be indicated by an asterisk (*). In this case an argument of type int supplies the field width or precision. Arguments specifying field width, or precision, or both must appear in that order before the argument, if any, to be con- verted. A negative field width is taken as a flag followed by a positive field width. A negative precision is taken as if the precision were omitted. In format wide-character strings containing the form of a conversion specification, a field width or precision may be indi- cated by the sequence where m is a decimal integer in the range giving the position in the argument list (after the format argument) of an integer argument containing the field width or precision, for example: The format can contain either numbered argument specifications (that is, and or unnumbered argument specifications (that is, and but nor- mally not both. The only exception to this is that can be mixed with the form. The results of mixing numbered and unnumbered argument specifications in a format wide-character string are undefined. When numbered argument specifications are used, specifying the Nth argu- ment requires that all the leading arguments, from the first to the (N-1)th, are specified in the format wide-character string. The flag wide-characters and their meanings are: The integer portion of the result of a decimal conversion (%i, %d, %u, %g, or %G ) will be formatted with thousands' grouping wide-characters. For other conversions the behavior is undefined. The non-monetary grouping wide-character is used. The result of the conversion will be left-justified within the field. The conversion will be right-justified if this flag is not specified. The result of a signed conversion will always begin with a sign (+ or -). The conversion will begin with a sign only when a negative value is converted if this flag is not speci- fied. If the first wide-character of a signed conversion is not a sign or if a signed conversion results in no wide-characters, a space will be prefixed to the result. This means that if the space and flags both appear, the space flag will be ignored. This flag specifies that the value is to be converted to an alternative form. For conversion, it increases the precision (if necessary) to force the first digit of the result to be 0. For or conver- sions, a non-zero result will have 0x (or 0X) prefixed to it. For or conversions, the result will always contain a radix character, even if no digits follow it. Without this flag, a radix character appears in the result of these conversions only if a digit follows it. For and conversions, trailing zeros will not be removed from the result as they normally are. For other conversions, the behavior is undefined. For and conversions, leading zeros (following any indication of sign or base) are used to pad to the field width; no space padding is performed. If the and flags both appear, the flag will be ignored. For and conversions, if a precision is specified, the flag will be ignored. If the and flags both appear, the grouping wide-characters are inserted before zero padding. For other conversions, the behavior is undefined. The conversion wide-characters and their meanings are: The int argument is converted to a signed decimal in the style [-]dddd. The precision specifies the minimum number of digits to appear; if the value being converted can be represented in fewer digits, it will be expanded with leading zeros. The default precision is 1. The result of converting 0 with an explicit precision of 0 is no wide-characters. The unsigned int argument is converted to unsigned octal format in the style dddd. The precision specifies the minimum number of digits to appear; if the value being converted can be represented in fewer digits, it will be expanded with leading zeros. The default precision is 1. The result of convert- ing 0 with an explicit precision of 0 is no wide-characters. The unsigned int argument is converted to unsigned decimal format in the style dddd. The precision specifies the minimum number of digits to appear; if the value being converted can be rep- resented in fewer digits, it will be expanded with leading zeros. The default precision is 1. The result of converting 0 with an explicit precision of 0 is no wide-characters. The unsigned int argument is converted to unsigned hexadecimal format in the style dddd; the letters are used. The precision specifies the minimum number of digits to appear; if the value being converted can be represented in fewer digits, it will be expanded with leading zeros. The default precision is 1. The result of converting 0 with an explicit precision of 0 is no wide-characters. Behaves the same as the conversion wide-character except that letters are used instead of The double argument is converted to decimal notation in the style [-]ddd.ddd, where the number of digits after the radix character is equal to the precision specification. If the precision is missing, it is taken as 6; if the precision is explicitly 0 and no flag is present, no radix character appears. If a radix character appears, at least one digit appears before it. The value is rounded to the appropriate num- ber of digits. The conversion specifier produces "INF", "INFINITY", or "NAN" instead of "inf", "infinity", or "nan", respectively. The family of functions may make available wide-character string representations for infinity and NaN. The double argument is converted in the style [-]d.ddde_dd, where there is one digit before the radix character (which is non-zero if the argument is non-zero) and the number of digits after it is equal to the precision; if the precision is missing, it is taken as 6; if the precision is 0 and no flag is present, no radix character appears. The value is rounded to the appropriate number of digits. The con- version wide-character will produce a number with instead of introducing the exponent. The exponent always contains at least two digits. If the value is 0, the exponent is 0. The family of functions may make available wide-character string representations for infinity and NaN. The double argument is converted in the style or (or in the style in the case of a conversion wide-character), with the precision specifying the number of significant digits. If an explicit precision is 0, it is taken as 1. The style used depends on the value converted; style (or will be used only if the exponent resulting from such a conversion is less than -4 or greater than or equal to the precision. Trailing zeros are removed from the fractional portion of the result; a radix character appears only if it is followed by a digit. The family of functions may make available wide-character string representations for infinity and NaN. For Itanium-based systems only. The double arg is converted in the style where r is the radix character. There is one digit before the radix character and the number of digits after it is equal to the precision. When the precision is missing, 13 digits are produced for 15 for and 28 for which is sufficient for an exact representation of the value. If the precision is 0, no radix character appears. The letters are used for conversion and the letters for conversion. The conversion specifier produces a number with and instead of and The exponent always contains at least one digit, and only as many more digits as necessary to represent the decimal exponent of 2. If the value is zero, the exponent is zero. For Itanium(R)-based systems if the optional decimal floating point feature is installed and enabled, then for an or spec- ifier, if an or modifier is present and the precision is missing, then for a decimal floating type argument represented with an integral coefficient c and quantum exponent q, where n is the number of digits in the coefficient c: o If 0 >= q >= -(n+5), use style formatting with formatting precision equal to -q. o Otherwise, use style formatting with formatting precision equal to n - 1. Except if then the digit-sequence in the exponent-part will have the value q (rather than 0). That the exponent is always expressed with the minimum number of digits required to represent its value (the exponent never contains a leading zero). If the precision modifier is present and at least as large as the precision of the decimal floating type, the conversion is as if the precision modifier were missing. If the precision modifier is present and less than the precision of the decimal floating type, the conversion first rounds the input, in the type, according to the current rounding direction for decimal floating-point operations. The rounding occurs to the number of digits specified by the precision modifier, then converts the result as if the precision modifier were missing. If no qualifier is present, the int argument is converted to a wide-character as if by calling the function and the resulting wide-character is written. Otherwise the wint_t argument is converted to wchar_t, and written. If no qualifier is present, the argument must be a pointer to a character array containing a character sequence beginning in the initial shift state. Characters from the array are converted as if by repeated calls to the function, with the conversion state described by an mbstate_t object initialized to zero before the first character is converted, and written up to (but not including) the terminating null wide-character. If the precision is specified, no more than that many wide-characters are written. If the precision is not specified or is greater than the size of the array, the array must contain a null wide-character. If an qualifier is present, the argument must be a pointer to an array of type wchar_t. Wide characters from the array are written up to (but not including) a terminating null wide-character. If no precision is specified or is greater than the size of the array, the array must contain a null wide-character. If a precision is specified, no more than that many wide-characters are written. The argument must be a pointer to void. The value of the pointer is converted to a sequence of printable wide-characters, in an implementation-dependent manner. The argument must be a pointer to an integer into which is written the number of wide-characters written to the output so far by this call to one of the functions. No argument is con- verted. Same as Same as Output a wide-character; no argument is converted. The entire conversion specification must be For Itanium(R)-based systems if the optional decimal floating point feature is installed and enabled, the behavior of the and speci- fiers for decimal floating point numbers is the same as for APPLICATION USAGE
After or is applied to a stream, the stream becomes wide-oriented (see orientation(5)). The prototypes of these functions are available to applications if they are: a. conformant. b. Compiled with macro with a value >=500. c. Compiled with macro with a value >= 200112. RETURN VALUE
Upon successful completion, these functions return the number of wide-characters transmitted excluding the terminating null wide-character in the case of or a negative value if an output error was encountered. If or more wide-characters were requested to be written, returns a negative value. ERRORS
For the conditions under which and fails, refer to see putwc(3C). In addition, all forms of may fail if one of the following occurs: A wide-character code that does not correspond to a valid character has been detected. There are insufficient arguments. Insufficient storage space is available. In addition, may fail if: is byte-oriented. may fail if: The stream pointed to by stream is byte-oriented. EXAMPLES
To print the language-independent date and time format, the following statement could be used: For American usage, format could be a pointer to the wide-character string: producing the message: whereas for German usage, format could be a pointer to the wide-character string: producing the message: AUTHOR
were developed by HP and Mitsubishi Electric Corporation. SEE ALSO
btowc(3C), fputwc(3C), fwscanf(3C), mbrtowc(3C), putwc(3C), setlocale(3C), orientation(5), thread_safety(5), glossary(9). fwprintf(3C)
Man Page