ifx_gl_wcstombs - convert a wide-character string to its multi-byte representation

SYNOPSIS

#include <ifxgls.h>
int ifx_gl_wcstombs(gl_mchar_t *mbs, gl_wchar_t *wcs, 
                    int wcs_char_length,
                    int mbs_byte_limit);

DESCRIPTION

This function converts the wide-character string wcs to its multi-byte representation and stores it in the location pointed to by mbs.

If wcs_char_length is the value IFX_GL_NULL then the function will assume that wcs is a null-terminated string; otherwise the function assumes that wcs_char_length is the number of characters in the wide-character string. See Wide-Character String Termination for more general information about wcs_char_length.

At most mbs_byte_limit bytes will written to mbs. If a character to be written to mbs would cause more than mbs_byte_limit bytes to be written to mbs, no part of that character is written to mbs. In this case, less than mbs_byte_limit bytes would be written to mbs, but mbs would still be considered full.

If wcs_char_length is equal to IFX_GL_NULL then the function will null-terminate mbs; otherwise it will not.

RETURN VALUES

This function returns the number of bytes that were written to mbs. If wcs_char_length is IFX_GL_NULL, return value does not count the null-terminator written to mbs.

ERRORS

If an error has occurred, this function returns -1 and sets ifx_gl_lc_errno() to one of the following,
[IFX_GL_PARAMERR]
wcs_char_length is not equal to IFX_GL_NULL and is not greater than or equal to zero
[IFX_GL_EILSEQ]
wcs contains an invalid wide-character

SEE ALSO

ifx_gl_mbstowcs()

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.