Converts a multibyte string to a wide-character string #include <stdlib.h> size_t mbstowcs ( wchar_t * restrict dest , const char * restrict src , size_t n ); The mbstowcs( ) function converts a multibyte string to a wide character string, and returns the number of wide characters in the result, not counting the wide string terminator. The first argument is a pointer to a buffer for the result; the second argument is a pointer to the string of multibyte characters to be converted; the third argument is the maximum number of wide characters to be written to the buffer. The conversion performed is equivalent to calling mbtowc( ) for each multibyte character in the original string, beginning in the initial shift state.
If mbstowcs( ) encounters an invalid multibyte character, it returns -1. ExampleSee the example for localeconv( ) in this chapter. See Also |