Mega Code Archive

 
Categories / C Tutorial / Stdlib h
 

Mbtowc

Item Value 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