C Tutorial/stdlib.h/mblen

Материал из C\C++ эксперт
Перейти к: навигация, поиск

mblen

Item Value Header file stdlib.h Declaration int mblen(const char *str, size_t size); Function returns the length (in bytes) of a multibyte character pointed to by str. Only the first size number of characters are examined. It returns -1 on error. Return If str is null, then mblen() returns nonzero if multibyte characters have state-dependent encodings. If they do not, zero is returned.


#include <stdlib.h>
  #include <stdio.h>
  int main(void){
     char *md = "asdfasdf";
     printf("%d", mblen(md, 2));
  }