wcstombs()

convert wide character string to multibyte string 

Function


SYNOPSIS

#include <stdlib.h>

size_t wcstombs(char *s, const wchar_t *pwcs, size_t n);


DESCRIPTION

The wcstombs() function converts a sequence of codes that correspond to multibyte characters from the array pointed to by pwcs into a sequence of multibyte characters that begins in the initial shift state. Then, wcstombs() stores these multibyte characters into the array pointed to by s. If a multibyte character exceeds the limit of n total bytes or if a NULL character is stored, wcstombs() stops. Each code is converted as if by a call to the wctomb() function, except that the shift state of the wctomb() function is not affected.

No more than n bytes are modified in the array pointed to by s. If copying takes place between objects that overlap, the behavior is undefined.


PARAMETERS

Points to the sequence of multibyte characters.

pwcs 

Points to the sequence of wide characters.

Is the maximum number of bytes that can be stored in the multibyte string.


RETURN VALUES

The wcstombs() function returns the number of bytes written into s, excluding the terminating NULL, if it was able to convert the wide character string. If the pwcs string is NULL, the wcstombs() function returns the required size of the destination string. If the conversion could not be performed, -1 is returned.


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:
setlocale(), wctomb()


MKS Toolkit 9.2 Documentation Build 16.