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

wctomb(3) Guardian Native C Library Calls Reference Manual
NAME
wctomb - Converts a wide character into a multibyte character
LIBRARY
G-series native Guardian processes: $SYSTEM.SYSnn.ZCRTLSRL
G-series native OSS processes: /G/system/sysnn/zcrtlsrl
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 <stdlib.h>
int wctomb (
char *s,
wchar_t wchar);
PARAMETERS
s Points to the location where the conversion is stored.
wchar Specifies the wide character to be converted.
DESCRIPTION
The wctomb() function converts a wide character into a multibyte character. The wctomb()
function stores no more than MB_CUR_MAX bytes.
The behavior of the wctomb() function is affected by the LC_CTYPE category of the current
locale. In environments with shift-state dependent encoding, calls to the wctomb() function
with the wchar parameter set to 0 (zero) put the function in its initial shift state. Subsequent calls
with the wchar parameter set to nonzero values alter the state of the function as necessary.
Changing the LC_CTYPE category of the locale causes the shift state of the function to be
unreliable.
NOTES
The implementation behaves as though no other function calls the wctomb() function.
RETURN VALUES
When the s parameter is not a null pointer, the wctomb() function returns a value determined as
follows:
If the wchar parameter corresponds to a valid multibyte character, the wctomb() func-
tion returns the number of bytes in the multibyte character.
If the wchar parameter does not correspond to a valid multibyte character, the wctomb()
function returns a value of -1, and sets errno to indicate the error.
When the s parameter is a null pointer, the return value depends on the environment in the fol-
lowing way:
In environments where encoding is not state dependent, wctomb() returns a value of 0
(zero).
In environments where encoding is state dependent, wctomb() returns a nonzero value.
In no case is the returned value greater than the value of MB_CUR_MAX.
7186 Hewlett-Packard Company 527192-018