wctomb()

convert wide character to multibyte character 

Function


SYNOPSIS

#include <stdlib.h>

int wctomb(char *s, wchar_t wchar);


DESCRIPTION

The wctomb() function converts wchar into a multibyte character and stores the result, up to MB_CUR_MAX bytes, in the array object pointed to by s. The behavior of this function is affected by the LC_CTYPE category for the current locale. When wctomb() is called with s as a NULL pointer, if the encoding has a state dependency a non-zero value is returned and the function is placed into its initial state, otherwise 0 is returned. Subsequent calls with s as other than a NULL pointer cause the internal state of the function to be altered as necessary. Changing the LC_CTYPE category causes the shift state of this function to be indeterminate.


PARAMETERS

s 

Is the address of the multibyte character.

wchar 

Is the wide character to convert.


RETURN VALUES

The wctomb() function returns the number of bytes, never greater than MB_CUR_MAX, in the wide character wchar. If wchar is the NULL character then wctomb() returns 1. If the conversion of wchar is not possible in the current locale, wctomb() returns -1.


CONFORMANCE

ANSI/ISO 9899-1990.


MULTITHREAD SAFETY LEVEL

MT-Safe, with exceptions.

This function is MT-Safe as long as no thread calls setlocale() while this function is executing.


PORTING ISSUES

None.


AVAILABILITY

MKS Toolkit for Professional Developers
MKS Toolkit for Enterprise Developers
MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

Functions:
mblen(), mbtowc(), setlocale(), wcstombs()


MKS Toolkit 9.2 Documentation Build 16.