mblen - C stdlib.h

C examples for stdlib.h:mblen

Type

function

From

<cstdlib>
<stdlib.h>

Description

Get length of multibyte character

Prototype


int mblen (const char* pmb, size_t max);

Parameters

Parameter Description
pmb Pointer to the first byte of a multibyte character.
max Maximum number of bytes of pmb to consider.

Return Value

On success, it returns the size in bytes of the character pointed by pmb.

Demo Code


#include <stdio.h>
#include <stdlib.h>

int main()//  w ww  . j ava  2  s.  c o  m
{
  const char str[] = "test string";

  int len = mblen(str, sizeof(str));

  printf("%d", len);

  return 0;
}

Related Tutorials