Guardian C Library Calls Reference Manual
wctomb
3-236 128833—Guardian TNS C Library Calls Reference Manual
Reference to Library Calls
wctomb
The wctomb function converts a wide character to a multibyte character.
s
points to a character array that will contain the multibyte character. This character
array should be at least MB_CUR_MAX characters long.
wchar
is a variable of type wchar_t that contains the wide character that the wctomb
function converts.
Return value
If s is a null pointer, the return value is 0.
If s is not a null pointer, the return value is:
Usage Guidelines
•
The MB_CUR_MAX macro specifies the maximum number of bytes used in
representing a multibyte character in the current locale (category LC_CTYPE). The
MB_CUR_MAX macro is defined in the header stdlibh as:
#define MB_CUR_MAX 2
•
The behavior of the wctomb function is affected by the LC_CTYPE category of the
current locale.
#include <stdlibh>
int wctomb(char *s, wchar_t wchar);
0if s points to a null character
1 if wchar is an ASCII character
2 if the first byte and the second byte in wchar form a valid 2-byte character
-1 if wchar is not a valid multibyte character