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

28 lines
461 B
C

#include <stdio.h>
#include <stdlib.h>
wchar_t wbuffer[] = {
0x0073,
0x0074,
0x0072,
0x0069,
0x006e,
0x0067,
0x0000
};
void main()
{
char mbsbuffer[50];
int i, len;
len = wcstombs( mbsbuffer, wbuffer, 50 );
if( len != -1 ) {
for( i = 0; i < len; i++ )
printf( "/%4.4x", wbuffer[i] );
printf( "\n" );
mbsbuffer[len] = '\0';
printf( "%s(%d)\n", mbsbuffer, len );
}
}