Open System Services Library Calls Reference Manual (G06.29+, H06.08+, J06.03+)
swprintf(3) OSS Library Calls Reference Manual
NAME
swprintf - Stores formatted output into a character array
LIBRARY
H-series and J-series native Guardian processes: $SYSTEM.ZDLLnnn.ZCRTLDLL
32-bit H-series and J-series OSS processes: /G/system/zdllnnn/zcrtldll
64-bit H-series and J-series OSS processes: /G/system/zdllnnn/ycrtldll
SYNOPSIS
#include <wchar.h>
int swprintf (
wchar_t *string,
size_t *n,
const wchar_t *format
[, value]...
);
PARAMETERS
string Points to a wide-character array in which the converted values will be stored.
n Specifies the size of the character array referred to by the string parameter. If n
is zero, no characters are stored and string might be a null pointer. Otherwise,
any generated characters beyond the n-1st are discarded, rather than being
stored, and a null character is appended after the last character that was stored.
format Specifies a wide-character string combining literal wide-characters with conver-
sion specifications.
value Specifies the data to be converted according to the format parameter.
DESCRIPTION
The swprintf( ) function converts, formats, and stores its value parameters, under control of the
format parameter, into consecutive bytes starting at the address specified by the string parameter.
The swprintf( ) function places a null wide-character at the end. You must ensure that enough
storage space is available to contain the formatted string.
In the TNS/E native environment, the swprintf( ) function supports all locales.
The format parameter is a character string that contains two types of objects:
• Literal characters, which are copied to the output stream.
• Conversion specifications, each of which causes zero or more items to be fetched from
the value parameter list.
If there are not enough items for format in the value parameter list, the results are unpredictable.
If more values remain after the entire format has been processed, they are ignored.
Conversion Specifications
Each conversion specification in the format parameter has the following syntax:
• A % (percent sign).
The swprintf( ) function can handle a format string that enables the system to process
elements of the parameter list in variable order. In such a case, the normal conversion
character % (percent sign) is replaced by %digit$, where digit is a decimal number in
the range from 1 to NL_ARGMAX. Conversion is then applied to the specified argu-
ment, rather than to the next unused argument. This feature provides for the definition of
format strings in an order appropriate to specific languages. When variable ordering is
6−200 Hewlett-Packard Company 527187-017