1.TH MBTOWC 3 scc\-VERSION2.SH NAME3mbtowc - convert a multibyte sequence to a wide character4.SH SYNOPSIS5#include <stdlib.h>67int mbtowc(wchar_t * restrict pwc, const char * restrict s, size_t n)8.SH DESCRIPTION9When10.I s11is not a null pointer,12the13.BR mbtowc ()14function examines up to15.I n16bytes starting at17.I s18to determine how many bytes form the next complete multibyte character,19including any required shift sequences.20If a complete, valid multibyte character is found,21the corresponding wide character value is computed and,22if23.I pwc24is not a null pointer,25stored in the object at26.IR pwc .27When the converted character is the null wide character,28the conversion state is reset to its initial value.29.SH RETURN VALUE30When31.I s32is a null pointer,33.BR mbtowc ()34returns non-zero if the current encoding has state-dependent sequences,35or zero otherwise.36When37.I s38is not a null pointer, the function returns:39.TP40041if42.I s43points to the null character;44.TP45positive46the number of bytes consumed to produce the wide character,47when the next48.I n49or fewer bytes form a valid multibyte character;50.TP51\-152if the bytes do not form a valid multibyte character.53.PP54The return value never exceeds55.I n56or the value of57.IR MB_CUR_MAX .58.SH STANDARDS59ISO/IEC 9899:1999 Section 7.20.7.2 Paragraph 1,2,3,4,560.SH SEE ALSO61.BR stdlib.h (3)62.BR wchar.h (3)