Home > Electronics Tutorials > C Language Tutorial > stdlib.h - Multibyte Functions - wcstombs

C Language Programming Library Reference Guide

stdlib.h - Multibyte Functions - wcstombs

Declaration: size_t wcstombs(char *str, const wchar_t *pwcs, size_t n); Converts the codes stored in the array pwcs to multibyte characters and stores them in the string str. It copies at most n bytes to the string. If a multibyte character overflows the n constriction, then none of that multibyte character's bytes are copied. Conversion stops when it reaches the null character or n bytes have been written to the string. The null character is stored in the string, but is not counted in the return value.

If an invalid code is reached, the value -1 is returned. Otherwise the number of bytes stored in the string is returned not including the terminating null character.

Note: To report broken links or to submit your projects, tutorials please email to Webmaster