C Language and Libraries Help (clang.hlp) (Table of Contents; Topic list)
WCTOMB.CPP
                                             Up Contents Index Back
─────Run-Time Library───────────────────────────────────────────────────────
 
/* WCTOMB.CPP illustrates the behavior of the wctomb function
 */
 
#include <stdlib.h>
#include <stdio.h>
 
void main( void )
{
    int      i;
    wchar_t  wc      = L'a';
    char    *pmbnull = NULL;
    char    *pmb     = (char *)malloc( sizeof( char ) );
 
    printf( "Convert a wide character:\" );
    i = wctomb( pmb, wc );
    printf( "\Characters converted: %u\", i );
    printf( "\Multibyte character: %.1s\\", pmb );
 
    printf( "Attempt to convert when target is NULL:\" );
    i = wctomb( pmbnull, wc );
    printf( "\Characters converted: %u\", i );
    printf( "\Multibyte character: %.1s\", pmbnull );
}
                                    -♦-