This repository has been archived on 2024-12-16. You can view files and clone it, but cannot push or open issues or pull requests.
CodeBlocksPortable/WATCOM/samples/clibexam/wctomb.c

21 lines
393 B
C
Raw Normal View History

#include <stdio.h>
#include <stdlib.h>
#include <mbctype.h>
wchar_t wchar = { 0x0073 };
char mbbuffer[2];
void main()
{
int len;
_setmbcp( 932 );
printf( "Character encodings are %sstate dependent\n",
( wctomb( NULL, 0 ) )
? "" : "not " );
len = wctomb( mbbuffer, wchar );
mbbuffer[len] = '\0';
printf( "%s(%d)\n", mbbuffer, len );
}