WCSTOMBS - convert wide character string to multibyte.

(ANSI Standard)

Usage:

#include <stdlib.h>
length = wcstombs(mbstring,wcstring,N);

Where:

char *mbstring;
points to an area of memory where "wcstombs" can store the resulting multibyte character string.
const wchar_t *wcstring;
points to the wide character string that is to be converted.
size_t N;
gives the maximum number of bytes that can be held by the multibyte string.

Description:

The "wcstombs" function converts wide characters from "wcstring" and stores them as multibyte characters in the memory indicated by "mbstring". If the locale has shift-dependencies, the multibyte string will begin in the initial shift state.

The function will stop if it encounters the null wide character. In this case, the null character will be converted and stored in "mbstring". The function will also stop if it cannot add the next converted multibyte character to "mbstring" without going over the limit of N bytes.

If "wcstombs" encounters a wide character value that has no corresponding multibyte character representation, it returns -1 cast to the "size_t" type. Otherwise, it returns the number of bytes stored in "mbstring", not counting a final zero character (if any).

See Also:

expl c lib mbstowcs

expl c lib mbtowc

expl c lib wctomb

Copyright © 1996, Thinkage Ltd.