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/wctob.c

37 lines
818 B
C
Raw Permalink Normal View History

#include <stdio.h>
#include <wchar.h>
#include <mbctype.h>
const wint_t wc[] = {
0x0020,
0x002e,
0x0031,
0x0041,
0x3000, /* double-byte space */
0xff21, /* double-byte A */
0x3048, /* double-byte Hiragana */
0x30a3, /* double-byte Katakana */
0xff61, /* single-byte Katakana punctuation */
0xff66, /* single-byte Katakana alphabetic */
0xff9f, /* single-byte Katakana alphabetic */
0x720d, /* double-byte Kanji */
0x0000
};
#define SIZE sizeof( wc ) / sizeof( wchar_t )
void main()
{
int i, j;
_setmbcp( 932 );
for( i = 0; i < SIZE; i++ ) {
j = wctob( wc[i] );
if( j == EOF ) {
printf( "%#6.4x EOF\n", wc[i] );
} else {
printf( "%#6.4x->%#6.4x\n", wc[i], j );
}
}
}