◄Up► ◄Contents► ◄Index► ◄Back► ─────Run-Time Library─────────────────────────────────────────────────────── /* WCSTOMBS.CPP illustrates the behavior of the wcstombs function */ #include <stdlib.h> #include <stdio.h> void main( void ) { int i; char *pmbbuf = (char *)malloc( MB_CUR_MAX ); wchar_t *pwcEOL = L'\'; wchar_t *pwchello = L"Hello, world."; printf( "Convert entire wide-character string:\" ); i = wcstombs( pmbbuf, pwchello, MB_CUR_MAX ); printf( "\Characters converted: %u\", i ); printf( "\Multibyte character: %s\\", pmbbuf ); printf( "Attempt to convert null character:\" ); i = wcstombs( pmbbuf, pwcEOL, MB_CUR_MAX ); printf( "\Characters converted: %u\", i ); printf( "\Multibyte character: %s\\", pmbbuf ); } -♦-