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,0,&mbs); /* initialize mbs */ while (*pt) { length = wcrtomb(buffer,*pt,&mbs); if ((length==0)||(length>MB_CUR_MAX)) break; putchar ('['); for (i=0;i<length;++i) putchar (buffer[i]); putchar (']'); ++pt; } return 0; }
http://www.cplusplus.com/reference/cwchar/wcrtomb/