mbtowc : mbtowc « stdlib.h « C Tutorial






ItemValue
Header filestdlib.h
Declarationint mbtowc(wchar_t *out, const char *in, size_t size);
Functionconverts the multibyte character *in into its wide-character equivalent *out. Only size number of characters will be examined.
Returnreturns the number of bytes that are put into *out or -1 or error. If in is null, then mbtowc() 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 *mb = "asdfadsf";
  char str[1000];

  mbtowc(str, mb, 2);
 
  printf("%s",str);

}
a








23.22.mbtowc
23.22.1.mbtowc