2 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for
3 .\" permission to reproduce portions of its copyrighted documentation.
4 .\" Original documentation from The Open Group can be obtained online at
5 .\" http://www.opengroup.org/bookstore/.
7 .\" The Institute of Electrical and Electronics Engineers and The Open
8 .\" Group, have given us permission to reprint portions of their
11 .\" In the following statement, the phrase ``this text'' refers to portions
12 .\" of the system documentation.
14 .\" Portions of this text are reprinted and reproduced in electronic form
15 .\" in the SunOS Reference Manual, from IEEE Std 1003.1, 2004 Edition,
16 .\" Standard for Information Technology -- Portable Operating System
17 .\" Interface (POSIX), The Open Group Base Specifications Issue 6,
18 .\" Copyright (C) 2001-2004 by the Institute of Electrical and Electronics
19 .\" Engineers, Inc and The Open Group. In the event of any discrepancy
20 .\" between these versions and the original IEEE and The Open Group
21 .\" Standard, the original IEEE and The Open Group Standard is the referee
22 .\" document. The original Standard can be obtained online at
23 .\" http://www.opengroup.org/unix/online.html.
25 .\" This notice shall appear on any product containing this material.
27 .\" The contents of this file are subject to the terms of the
28 .\" Common Development and Distribution License (the "License").
29 .\" You may not use this file except in compliance with the License.
31 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
32 .\" or http://www.opensolaris.org/os/licensing.
33 .\" See the License for the specific language governing permissions
34 .\" and limitations under the License.
36 .\" When distributing Covered Code, include this CDDL HEADER in each
37 .\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
38 .\" If applicable, add the following below this CDDL HEADER, with the
39 .\" fields enclosed by brackets "[]" replaced with your own identifying
40 .\" information: Portions Copyright [yyyy] [name of copyright owner]
43 .\" Copyright (c) 1992, X/Open Company Limited. All Rights Reserved.
44 .\" Portions Copyright (c) 2003, Sun Microsystems, Inc. All Rights Reserved.
45 .\" Copyright 2014 Garrett D'Amore <garrett@damore.org>
47 .TH MBSRTOWCS 3C "Jun 28, 2014"
49 mbsnrtowcs, mbsnrtowcs_l, mbsrtowcs, mbsrtowcs_l \- convert a character string
50 to a wide-character string (restartable)
56 \fBsize_t\fR \fBmbsnrtowcs\fR(\fBwchar_t *restrict\fR \fIdst\fR, \fBconst char **restrict\fR \fIsrc\fR,
57 \fBsize_t\fR \fInms\fR, \fBsize_t\fR \fIlen\fR, \fBmbstate_t *restrict\fR \fIps\fR);
61 \fBsize_t\fR \fBmbsrtowcs\fR(\fBwchar_t *restrict\fR \fIdst\fR, \fBconst char **restrict\fR \fIsrc\fR,
62 \fBsize_t\fR \fIlen\fR, \fBmbstate_t *restrict\fR \fIps\fR);
69 \fBsize_t\fR \fBmbsnrtowcs_l\fR(\fBwchar_t *restrict\fR \fIdst\fR, \fBconst char **restrict\fR \fIsrc\fR,
70 \fBsize_t\fR \fInms\fR, \fBsize_t\fR \fIlen\fR, \fBmbstate_t *restrict\fR \fIps\fR, \fBlocale_t\fR \fIloc\fR);
74 \fBsize_t\fR \fBmbsrtowcs_l\fR(\fBwchar_t *restrict\fR \fIdst\fR, \fBconst char **restrict\fR \fIsrc\fR,
75 \fBsize_t\fR \fIlen\fR, \fBmbstate_t *restrict\fR \fIps\fR, \fBlocale_t\fR \fIloc\fR);
79 These function converts a sequence of characters, beginning in
80 the conversion state described by the object pointed to by \fIps\fR, from the
81 array indirectly pointed to by \fIsrc\fR into a sequence of corresponding
82 wide-characters. If \fIdst\fR is not a null pointer, the converted characters
83 are stored into the array pointed to by \fIdst\fR. Conversion continues up to
84 and including a terminating null character, which is also stored. Conversion
85 stops early in either of the following cases:
90 When a sequence of bytes is encountered that does not form a valid character.
96 When \fIlen\fR codes have been stored into the array pointed to by \fIdst\fR
97 (and \fIdst\fR is not a null pointer).
100 Each conversion takes place as if by a call to the \fBmbrtowc()\fR function.
102 If \fIdst\fR is not a null pointer, the pointer object pointed to by \fIsrc\fR
103 is assigned either a null pointer (if conversion stopped due to reaching a
104 terminating null character) or the address just past the last character
105 converted (if any). If conversion stopped due to reaching a terminating null
106 character, and if \fIdst\fR is not a null pointer, the resulting state
107 described is the initial conversion state.
109 If \fIps\fR is a null pointer, these functions uses their own
110 internal \fBmbstate_t\fR object, which is initialized at program startup to the
111 initial conversion state. Otherwise, the \fBmbstate_t\fR object pointed to by
112 \fIps\fR is used to completely describe the current conversion state of the
113 associated character sequence. The system will behave as if no function defined
114 in the Reference Manual calls any of these functions.
116 The function \fBmbsnrtowcs()\fR behaves identically to \fBmbsrtowcs()\fR,
117 except the conversion stops after reading \fInms\fR bytes from the
118 buffer pointed to by \fIsrc\fR.
120 The behavior of \fBmbnrtowcs()\fR and \fBmbsrtowcs()\fR functions are
121 affected by the \fBLC_CTYPE\fR category of the
122 current locale. See \fBenviron\fR(5). The functions \fBmbsrtowcs_l()\fR and
123 \fBmbsnrtowcs_l()\fR behave identically to \fBmbsrtowcs()\fR and
124 \fBmbsnrtowcs()\fR, except that instead of using the current locale, they use
125 the locale specified by \fIloc\fR.
128 If the input conversion encounters a sequence of bytes that do not form a valid
129 character, an encoding error occurs. In this case, these
130 functions store the value of the macro \fBEILSEQ\fR in \fBerrno\fR and return
131 \fB(size_t)\(mi1\fR; the conversion state is undefined. Otherwise, they return
132 the number of characters successfully converted, not including the terminating
136 Theses functions may fail if:
143 The \fIps\fR argument points to an object that contains an invalid conversion
153 Invalid character sequence is detected.
157 See \fBattributes\fR(5) for descriptions of the following attributes:
162 ATTRIBUTE TYPE ATTRIBUTE VALUE
164 Interface Stability See below.
174 functions are Standard. The
178 functions are Uncommitted.
180 If \fIps\fR is not a null pointer, these functions use the \fBmbstate_t\fR
181 object pointed to by \fIps\fR and can be used safely in
182 multithreaded applications, otherwise they use an
183 internal \fBmbstate_t\fR object and are Unsafe in multithreaded
187 \fBmbrtowc\fR(3C), \fBmbsinit\fR(3C), \fBnewlocale\fR(3C),
188 \fBsetlocale\fR(3C), \fBuselocale()\fR, \fBattributes\fR(5),
189 \fBenviron\fR(5), \fBstandards\fR(5)