Mega Code Archive

 
Categories / C Tutorial / Stdlib h
 

Mblen

Item Value Header filestdlib.h Declarationint mblen(const char *str, size_t size); Functionreturns 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. ReturnIf 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));   } 1