#include <stdlib.h>size_t wcstombs(char *out, const wchar_t *in, size_t size);
The wcstombs( ) function converts the wide-character array pointed to by in into its multibyte equivalent and puts the result in the array pointed to by out. Only the first size bytes of in are converted. Conversion stops before that if the null terminator is encountered.
In C99, out and in are qualified by restrict.
If successful, wcstombs( ) returns the number of bytes written. On failure, -1 is returned.
Related functions are wctomb( ) and mbstowcs( ).