{{keywords>wiki library source code example reference}} ===== wcstombs ===== #include size_t wcstombs(char *str, const wchar_t *pwcs, size_t n); ===== Description ===== wcstombs converts a wide character string into a multibyte character string.\\ conversion stops after the size n is reached.\\ The behavior of wcstombs is affected by the LC_CTYPE category of the current locale\\ str = destination string\\ pwcs = pointer to wide string\\ n = chars to convert\\ is for this example nessesary ===== wcstombs C Sourcecode Example ===== /* * wcstombs example code * http://code-reference.com/c/stdlib.h/wcstombs */ #include #include #include /* setlocale function */ int main(void) { char str[60]; wchar_t *pwcs = L"wcstombs tést äüö for code-reference.com"; size_t count = 60; size_t n; setlocale(LC_ALL, ""); n = wcstombs(str, pwcs, count); printf("%d characters from string \"%s\" converted.\n", n, str); return 0; } ==== output of wcstombs example ==== user@host:~$ ./wcstombs 44 characters from string "wcstombs tést äüö for code-reference.com" converted.