ifx_gl_mbsnext -- returns the next multi-byte character

SYNOPSIS

#include <ifxgls.h>
gl_mchar_t *ifx_gl_mbsnext(gl_mchar_t *mb, int mb_byte_limit)

DESCRIPTION

This function returns a pointer to the next multi-byte character after mb.

If mb_byte_limit is IFX_GL_NO_LIMIT then this function will read as many bytes as necessary from mb to form a complete character; otherwise, it will not read more than mb_byte_limit bytes from mb when trying to form a complete character. See Multi-Byte Character Termination for more general information about mb_byte_limit.

RETURN VALUES

This function returns a pointer to the byte immediately following mb.

ERRORS

If an error has occurred, this function returns NULL and sets ifx_gl_lc_errno() to,
[IFX_GL_EILSEQ]
mb is not a valid multi-byte character
[IFX_GL_EINVAL]
The function cannot determine whether mb is a valid multi-byte 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 zero, this function always gives this error. See Keeping Multi-Byte Strings Consistent for more information about this error.

APPLICATION USAGE

This function is typically used to transform the single-byte loop,
  for ( sb = sbs; *sb != '\0'; sb++ )
    {
    /* Process single-byte character */
    }
to the multi-byte loop,
  for ( mb = mbs; *mb != '\0'; )
    {
    /* Process multi-byte character */
    if ( (mb = ifx_gl_mbsnext(mb, IFX_GL_NO_LIMIT)) == NULL )
      /* Handle error */
    }

SEE ALSO

ifx_gl_mbsprev(), ifx_gl_mblen(),

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.