The ifx_gl_wcstombs() function

The ifx_gl_wcstombs() function converts a wide-character string to its multibyte representation.

Syntax

#include <ifxgls.h>
...
int ifx_gl_wcstombs(mbs, wcs, wcs_char_length, mbs_byte_limit)
       gl_mchar_t *mbs;
       gl_wchar_t *wcs;
       int wcs_char_length;
       int mbs_byte_limit;
mbs
A pointer to the multibyte-character string that contains the multibyte equivalent for wcs.
wcs
A pointer to the wide-character string to convert to the mbs multibyte string.
wcs_char_length
The integer number of characters in the wcs string. If wcs_char_length is the value IFX_GL_NULL, the function assumes that wcs is a null-terminated string.
mbs_byte_limit
The integer number of bytes to read from mbs.
Valid in client application Valid in DataBlade® UDR
Yes Yes

Usage

The ifx_gl_wcstombs() function converts the wide-character string wcs to its multibyte representation and stores the result in the location that mbs references.

The function writes at most mbs_byte_limit bytes to mbs. If a particular character 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, fewer than mbs_byte_limit bytes are written to mbs, but mbs is still considered full.

If wcs_char_length is equal to IFX_GL_NULL, the function null-terminates mbs. Any other value of wcs_char_length means that the function does not null-terminate the resulting string.

Return values

>=0
The number of characters that were written to mbs, not including any null terminator.
-1
The function was not successful, and the error number is set to indicate the cause. See the Errors section.

Errors

If an error occurred, this function returns -1 and sets the ifx_gl_lc_errno() error number to one of the following values.
IFX_GL_PARAMERR
The wcs_char_length is not equal to IFX_GL_NULL and is not greater than or equal to 0.
IFX_GL_EILSEQ
The *wcs value contains an invalid wide character.