Wcstombs_sワイドバイトからマルチバイト



Wcstombs_s Wide Byte Multibyte

// crt_wcstombs_s.c // This example converts a wide character // string to a multibyte character string. #include #include #include #define BUFFER_SIZE 100 int main( void ) { size_t i char *pMBBuffer = (char *)malloc( BUFFER_SIZE ) wchar_t*pWCBuffer = L'Hello, world.' printf( 'Convert wide-character string: ' ) // Conversion wcstombs_s(&i, pMBBuffer, (size_t)BUFFER_SIZE, pWCBuffer, (size_t)BUFFER_SIZE ) // Output printf(' Characters converted: %u ', i) printf(' Multibyte character: %s ', pMBBuffer ) // Free multibyte character buffer if (pMBBuffer) { free(pMBBuffer) } }

出力

|_+_|