Guardian Native C Library Calls Reference Manual (G06.29+, H06.08+, J06.03+)

Guardian Native C Library Calls (t - z) wcrtomb(3)
NAME
wcrtomb - Convert a wide-character code to a character (restartable)
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>
size_t wcrtomb(
char *s,
char_t wc,
mbstate_t *ps
);
PARAMETERS
s Points to object containing the converted character
ws The wide-character to be converted.
ps Points to the mbstate_t object.
DESCRIPTION
If s is a null pointer, the wcrtomb() function is equivalent to the call:
wcrtomb(buf, L , ps)
where buf is an internal buffer.
If s is not a null pointer, the wcrtomb() function determines the number of bytes needed to
represent the character that corresponds to the wide-character given by wc, and stores the result-
ing bytes in the array whose first element is pointed to by s. At most MB_CUR_MAX bytes are
stored. If wc is a null wide-character, a null byte is stored. The resulting state described is the ini-
tial conversion state.
If ps is a null pointer, the wcrtomb() function use its own internal mbstate_t object, which is
initialized at program startup to the initial conversion state. Otherwise the mbstate_t object
pointed to by ps is used to completely describe the current conversion state of the associated
character sequence. The implementation behaves as if no function dened in this specification
calls wcrtomb().
RETURN VALUES
The wcrtomb() function returns the number of bytes stored in the array object. When wc is not a
valid wide-character, an encoding error occurs. In this case, wcrtomb() sets errno to [EILSEQ]
and returns (size_t)(-1), and the conversion state is undefined.
ERRORS
If any of these conditions occurs, errno is set to the corresponding value:
[EINVAL] The ps parmeter points to an object that contains an invalid conversion state.
[EILSEQ] An invalid character sequence is detected.
RELATED INFORMATION
Functions:
mbsinit(3).
527192-018 Hewlett-Packard Company 7131