#include <stdlib.h> length = wcstombs(mbstring,wcstring,N);
The "wcstombs" function converts wide characters from "wcstring" and stores them as multibyte characters in the memory indicated by "mbstring". If the locale has shift-dependencies, the multibyte string will begin in the initial shift state.
The function will stop if it encounters the null wide character. In this case, the null character will be converted and stored in "mbstring". The function will also stop if it cannot add the next converted multibyte character to "mbstring" without going over the limit of N bytes.
If "wcstombs" encounters a wide character value that has no corresponding multibyte character representation, it returns -1 cast to the "size_t" type. Otherwise, it returns the number of bytes stored in "mbstring", not counting a final zero character (if any).
expl c lib mbstowcs
expl c lib mbtowc
expl c lib wctomb
Copyright © 1996, Thinkage Ltd.