int wctomb ( char * pmb, wchar_t character ); |
<cstdlib> |
Convert wide character to multibyte character
The wide character specified as second argument is translated to its multibyte equivalent and stored in the array pointed by pmb. The length in bytes of the equivalent multibyte character pointed by pmb is returned.
wctomb has its own internal shift state, which is altered as necessary only by calls to this function.
Parameters
- pmb
- Pointer to an array large enough to hold a multibyte character, which at most is MB_CUR_MAX.
Alternativelly, the function may be called with a null pointer, in which case the function resets its internal shift state to the initial value and returns whether multibyte characters have state-dependent encodings or not.
- character
- Wide character of type wchar_t.
Return Value
If the argument passed as
pmb is not a null pointer, the size in bytes of the character pointed by
pmb is returned when it forms a valid multibyte character and is not the terminating null character. If it is the terminating null character, the function returns zero, and in the case they do not form a valid multibyte character,
-1 is returned.
If the argument passed as
pmb is a null pointer, the function returns a nonzero value if multibyte character encodings are state-dependent, and zero otherwise.
See also
mblen | Get length of multibyte character (function) |
mbtowc | Convert multibyte character to wide character (function) |
mbstowcs | Convert multibyte string to wide-character string (function) |
wcstombs | Convert wide-character string to multibyte string (function) |