#define __STDC_WANT_LIB_EXT1__ 1 #include #include wchar_t wbuffer[] = { 0x0073, 0x0074, 0x0072, 0x0069, 0x006e, 0x0067, 0x0000 }; int main() { char mbsbuffer[50]; int i; size_t retval; errno_t rc; rc = wcstombs_s( &retval, mbsbuffer, 50, wbuffer, sizeof( wbuffer ) ); if( rc == 0 ) { for( i = 0; i < retval; i++ ) printf( "/%4.4x", wbuffer[i] ); printf( "\n" ); mbsbuffer[retval] = '\0'; printf( "%s(%d)\n", mbsbuffer, retval ); } return( rc ); }