{{keywords>wiki library source code example reference}} ===== wctomb ===== #include int wctomb(char *str, wchar_t wchar); ===== Description ===== wctomb converts a wide character to a multibyte character in the string.\\ wctomb maximum MB_CUR_MAX sign stores in a string.\\ The behavior of wctomb is affected by the LC_CTYPE category of the current locale\\ is for this example nessesary ===== wctomb C Sourcecode Example ===== /* * wctomb example code * http://code-reference.com/c/stdlib.h/wctomb */ #include #include #include int main(void) { static char string[5]; wchar_t wchar = L'é'; int length; setlocale(LC_ALL, ""); length = wctomb(string, wchar); printf("number of bytes in the multibyte character : %i\n", length); printf("converted string : \"%s\"\n", string); return 0; } ==== output of wctomb example ==== user@host:~/code-reference.com# ./wctomb number of bytes in the multibyte character : 2 converted string : "é"