mbsadvance Subroutine

Purpose

Advances to the next multibyte character.

Note: The mbsadvance subroutine is specific to the manufacturer. It is not defined in the POSIX, ANSI, or X/Open standards. Use of this subroutine may affect portability.

Library

Standard C Library (libc.a)

Syntax

#include <mbstr.h>

char *mbsadvance ( S)
const char *S;

Description

The mbsadvance subroutine locates the next character in a multibyte character string. The LC_CTYPE category affects the behavior of the mbsadvance subroutine.

Parameters

Item Description
S Contains a multibyte character string.

Return Values

If the S parameter is not a null pointer, the mbsadvance subroutine returns a pointer to the next multibyte character in the string pointed to by the S parameter. The character at the head of the string pointed to by the S parameter is skipped. If the S parameter is a null pointer or points to a null string, a null pointer is returned.

Examples

To find the next character in a multibyte string, use the following:

#include <mbstr.h>
#include <locale.h>
#include <stdlib.h>
main()
{
   char *mbs, *pmbs;
   (void) setlocale(LC_ALL, "");
   /*
   ** Let mbs point to the beginning of a multi-byte string.
   */
   pmbs = mbs;
   while(pmbs){
      pmbs = mbsadvance(mbs);
      /* pmbs points to the next multi-byte character
      ** in mbs */
}