The ifx_gl_mbstowcs() function
The ifx_gl_mbstowcs() function converts a multibyte character string to its wide-character representation.
Syntax
#include <ifxgls.h>
...
int ifx_gl_mbstowcs(wcs, mbs, mbs_byte_length, char_limit)
gl_wchar_t *wcs;
gl_mchar_t *mbs;
int mbs_byte_length;
int char_limit;
- wcs
- A pointer to the wide-character string that contains the wide-character equivalent of mbs.
- mbs
- A pointer to the multibyte-character string to convert to the wcs wide-character string.
- mbs_byte_length
- The integer number of bytes in the mbs string. If mbs_byte_length is the value IFX_GL_NULL, the function assumes that mbs is a null-terminated string.
- char_limit
- The maximum number of multibyte characters to read from mbs.
Valid in client application | Valid in DataBlade® UDR |
---|---|
Yes | Yes |
Usage
The ifx_gl_mbstowcs() function converts mbs into its wide-character representation and stores the result in the location that wcs references. The function reads no more than char_limit characters from mbs and writes them to wcs.
If mbs_byte_length is equal to IFX_GL_NULL, the function null-terminates the string in wcs. Any other value of mbs_byte_length means that the function does not null-terminate the resulting wide-character string.
Return values
- >=0
- The number of characters read from mbs and written to wcs, not counting 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 mbs_byte_length is not equal to IFX_GL_NULL and is not greater than or equal to 0.
- IFX_GL_EILSEQ
- The *mbs value contains an invalid multibyte character.
- IFX_GL_EINVAL
- The function cannot determine whether the last character of mbs is a valid multibyte character because it would need to read more than mbs_byte_length bytes from mbs.