The ifx_gl_putmb() function

The ifx_gl_putmb() function puts a single multibyte character in a user-defined location.

Syntax

#include <ifxgls.h>
...
int ifx_gl_putmb(mb, mb_byte_limit, funcp, v, bytes_put)
        gl_mchar_t *mb;
        int mb_byte_limit;
        int (*funcp)(gl_mchar_t byte, void *v);
        void *v;
        int *bytes_put;
mb
A pointer to the multibyte character whose bytes the funcp function writes to a specified location.
mb_byte_limit
The number of bytes in mb that the ifx_gl_putmb() function reads when it tries to form a complete multibyte character. If mb_byte_limit is IFX_GL_NO_LIMIT, this function reads as many bytes as necessary from mb to form a complete character.
funcp
A pointer to a function that you define to specify the location at which to write the multibyte character.
v
An argument to the user-defined function, which is a parameter to ifx_gl_putmb(). Use v to specify where the character should go; for example, stdout, stderr, a file, and other locations.
bytes_put
Valid in client application Valid in DataBlade® UDR
Yes Yes

Usage

The ifx_gl_putmb() function calls a function that you define to put the bytes that form one multibyte character in a specified location. This multibyte character is read from the mb buffer.

The funcp argument is a pointer to a function that you must define as follows:
int funcp(gl_mchar_t byte, void *v)

On success, funcp must return 0. On failure, funcp must return -1. The number of bytes that funcp successfully puts is returned in bytes_put (even when funcp fails).

Return values

0
The function was successful.
-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_EILSEQ
The *mb value is not a valid multibyte character.
IFX_GL_EINVAL
The funcp function cannot determine whether mb is a valid multibyte character because it would need to read more than mb_byte_limit bytes from mb. If mb_byte_limit is less than or equal to 0, this function always returns this error.
IFX_GL_EIO
The funcp function returned -1 when first called.