Standard C++ Library Reference ISO/IEC (VERSION3)

multibyte string begins in the initial conversion state. The function converts each wide character
as if by calling wctomb (except that the conversion state stored for that function is unaffected).
It stores no more than n bytes, stopping after it stores a null byte. It returns the number of bytes
it stores, not counting the null byte, if all conversions are successful; otherwise, it returns -1.
wctomb
int wctomb(char *s, wchar_t wchar);
If s is not a null pointer, the function determines x, the number of bytes needed to represent
the multibyte character corresponding to the wide character wchar. x cannot exceed
MB_CUR_MAX. The function converts wchar to its corresponding multibyte character, which it
stores in successive elements of the array whose first element has the address s. It then returns
x, or it returns -1 if wchar does not correspond to a valid multibyte character. wctomb
includes the terminating null byte in the count of bytes. The function can use a conversion state
stored in a static-duration object to determine how to interpret the multibyte character string.
If s is a null pointer and if multibyte characters have a state-dependent encoding in the current
locale, the function stores the initial conversion state in its static-duration object and returns
nonzero; otherwise, it returns zero.
See also the Table of Contents and the Index.
Copyright © 1989-2001 by P.J. Plauger and Jim Brodie. All rights reserved.