Multibyte characters
- mblen
- Get length of multibyte character (function )
- mbtowc
- Convert multibyte sequence to wide character (function )
- wctomb
- Convert wide character to multibyte sequence (function )
Multibyte strings
- mbstowcs
- Convert multibyte string to wide-character string (function )
- wcstombs
- Convert wide-character string to multibyte string (function )
http://www.cplusplus.com/reference/cstdlib/
/* wcrtomb example */
#include <wchar.h>
#include <stdio.h>
#include <stdlib.h> int main() {
const wchar_t* pt = L"wcrtomb example";
char buffer [MB_CUR_MAX];
size_t length, i;
mbstate_t mbs; mbrlen (NULL,,&mbs); /* initialize mbs */ while (*pt) {
length = wcrtomb(buffer,*pt,&mbs);
if ((length==)||(length>MB_CUR_MAX)) break;
putchar ('[');
for (i=;i<length;++i) putchar (buffer[i]);
putchar (']');
++pt;
} return ;
}
http://www.cplusplus.com/reference/cwchar/wcrtomb/