ifx_gl_wctomb - convert one wide-character to its multi-byte representation
SYNOPSIS
#include <ifxgls.h>
int ifx_gl_wctomb(gl_mchar_t *mb, gl_wchar_t wc);
DESCRIPTION
This function converts the wide-character in wc to its
multi-byte representation and stores it in consecutive bytes starting
at mb.
RETURN VALUES
This function returns the number of bytes that were
written to mb.
ERRORS
If an error has occurred, this function returns -1 and sets
ifx_gl_lc_errno
to,
- IFX_GL_EILSEQ
-
wc is not a valid wide-character. In this case, some bytes may
be written to mb, but the contents of mb are undefined.
MEMORY MANAGEMENT
This function assumes that mb contains enough space to hold the
multi-byte representation of wc. There are two ways to determine
the number of bytes that will be written to mb.
The function
ifx_gl_mb_loc_max()
calculates the maximum number of bytes in the multi-byte representation for
any wide-character for the current locale.
The macro
IFX_GL_MB_MAX
is the maximum number of bytes in the multi-byte representation for
any wide-character in any locale.
This value will always be equal
to or greater
than the value returned by
ifx_gl_mb_loc_max().
Of the two options, the macro
IFX_GL_MB_MAX
is the fastest and the only one
that can be used to initialize static buffers. The function
ifx_gl_mb_loc_max()
is slower, but more precise.
SEE ALSO
ifx_gl_mbtowc()
ifx_gl_wcstombs()
ifx_gl_mbstowcs()
ifx_gl_mb_loc_max()
IFX_GL_MB_MAX
ACKNOWLEDGEMENT
Portions of this description were derived from the X/Open CAE
Specification: "System Interfaces and Headers, Issue 4"; X/Open
Document Number: C202; ISBN: 1-872630-47-2; Published by X/Open Company
Ltd., U.K.