'\" te .\" Copyright (c) 2003, Sun Microsystems, Inc. All Rights Reserved. .TH mbstowcs 3C "1 Nov 2003" "SunOS 5.11" "Standard C Library Functions" .SH NAME mbstowcs \- convert a character string to a wide-character string .SH SYNOPSIS .LP .nf #include \fBsize_t\fR \fBmbstowcs\fR(\fBwchar_t *restrict\fR \fIpwcs\fR, \fBconst char *restrict\fR \fIs\fR, \fBsize_t\fR \fIn\fR); .fi .SH DESCRIPTION .sp .LP The \fBmbstowcs()\fR function converts a sequence of characters from the array pointed to by \fIs\fR into a sequence of corresponding wide-character codes and stores not more than \fIn\fR wide-character codes into the array pointed to by \fIpwcs\fR. No characters that follow a null byte (which is converted into a wide-character code with value \fB0\fR) will be examined or converted. Each character is converted as if by a call to \fBmbtowc\fR(3C). .sp .LP No more than \fIn\fR elements will be modified in the array pointed to by \fIpwcs\fR. If copying takes place between objects that overlap, the behavior is undefined. .sp .LP The behavior of this function is affected by the \fBLC_CTYPE\fR category of the current locale. If \fIpwcs\fR is a null pointer, \fBmbstowcs()\fR returns the length required to convert the entire array regardless of the value of \fIn\fR, but no values are stored. .SH RETURN VALUES .sp .LP If an invalid character is encountered, \fBmbstowcs()\fR returns (\fBsize_t\fR)\fB\(mi1\fR and may set \fBerrno\fR to indicate the error. Otherwise, \fBmbstowcs()\fR returns the number of the array elements modified (or required if \fIpwcs\fR is \fBNULL),\fR not including a terminating \fB0\fR code, if any. The array will not be zero-terminated if the value returned is \fIn\fR. .SH ERRORS .sp .LP The \fBmbstowcs()\fR function may fail if: .sp .ne 2 .mk .na \fB\fBEILSEQ\fR\fR .ad .RS 10n .rt Invalid byte sequence is detected. .RE .SH ATTRIBUTES .sp .LP See \fBattributes\fR(5) for descriptions of the following attributes: .sp .sp .TS tab() box; lw(2.75i) |lw(2.75i) lw(2.75i) |lw(2.75i) . ATTRIBUTE TYPEATTRIBUTE VALUE _ CSIEnabled _ Interface StabilityCommitted _ MT-LevelMT-Safe _ StandardSee \fBstandards\fR(5). .TE .SH SEE ALSO .sp .LP \fBmblen\fR(3C), \fBmbtowc\fR(3C), \fBsetlocale\fR(3C), \fBwcstombs\fR(3C), \fBwctomb\fR(3C), \fBattributes\fR(5), \fBstandards\fR(5)