Example
This program illustrates the behavior of the wcstombs function.
// crt_wcstombs.c
#include <stdio.h>
#include <stdlib.h>
int main( void )
{
int i;
char *pmbbuf = (char *)malloc( 100 );
wchar_t *pwchello = L"Hello, world.";
printf( "Convert wide-character string:\n" );
i = wcstombs( pmbbuf, pwchello, 100 );
printf( " Characters converted: %u\n", i );
printf( " Multibyte character: %s\n\n", pmbbuf );
}
Output
Convert wide-character string: Characters converted: 13 Multibyte character: Hello, world.