Converts a wide character into a multibyte character.
#include <stdlib.h>
int wctomb (Storage, WideCharacter) char *Storage; wchar_t WideCharacter;
The wctomb subroutine determines the number of bytes required to represent the wide character specified by the WideCharacter parameter as the corresponding multibyte character. It then converts the WideCharacter value to a multibyte character and stores the results in the area pointed to by the Storage parameter. The wctomb subroutine can store a maximum of MB_CUR_MAX bytes in the area pointed to by the Storage parameter. Thus, the length of the area pointed to by the Storage parameter should be at least MB_CUR_MAX bytes. The MB_CUR_MAX macro is defined in the stdlib.h file.
Storage | Points to an area where the result of the conversion is stored. |
WideCharacter | Specifies a wide-character value. |
The wctomb subroutine returns a 0 if the Storage parameter is a null pointer. If the WideCharacter parameter does not correspond to a valid multibyte character, a -1 is returned. Otherwise, the number of bytes that comprise the multibyte character is returned.
This subroutine is part of Base Operating System (BOS) Runtime.
The mbtowc subroutine, mbstowcs subroutine, wcslen subroutine, wcstombs subroutine.
National Language Support Overview for Programming, Subroutines Overview, Understanding Multibyte Code and Wide Character Code Conversion Subroutines in AIX Version 4.3 General Programming Concepts: Writing and Debugging Programs.