1
by Francesco Paolo Lovergine
rules: linking manpages-posix not manpages. |
1 |
.\" Copyright (c) 2001-2003 The Open Group, All Rights Reserved |
2
by Francesco Paolo Lovergine
* Alligned to linux main manpages edition. |
2 |
.TH "MBSRTOWCS" P 2003 "IEEE/The Open Group" "POSIX Programmer's Manual" |
1
by Francesco Paolo Lovergine
rules: linking manpages-posix not manpages. |
3 |
.\" mbsrtowcs |
4 |
.SH NAME |
|
5 |
mbsrtowcs \- convert a character string to a wide-character string
|
|
6 |
(restartable) |
|
7 |
.SH SYNOPSIS |
|
8 |
.LP
|
|
9 |
\fB#include <wchar.h>
|
|
10 |
.br
|
|
11 |
.sp
|
|
12 |
size_t mbsrtowcs(wchar_t *restrict\fP \fIdst\fP\fB, const char **restrict\fP |
|
13 |
\fIsrc\fP\fB, |
|
14 |
.br
|
|
15 |
\ \ \ \ \ \ size_t\fP \fIlen\fP\fB, mbstate_t *restrict\fP \fIps\fP\fB); |
|
16 |
.br
|
|
17 |
\fP
|
|
18 |
.SH DESCRIPTION |
|
19 |
.LP
|
|
20 |
The \fImbsrtowcs\fP() function shall convert a sequence of characters, |
|
21 |
beginning in the conversion state described by the |
|
22 |
object pointed to by \fIps\fP, from the array indirectly pointed to |
|
23 |
by \fIsrc\fP into a sequence of corresponding wide |
|
24 |
characters. If \fIdst\fP is not a null pointer, the converted characters |
|
25 |
shall be stored into the array pointed to by \fIdst\fP. |
|
26 |
Conversion continues up to and including a terminating null character, |
|
27 |
which shall also be stored. Conversion shall stop early in |
|
28 |
either of the following cases: |
|
29 |
.IP " *" 3 |
|
30 |
A sequence of bytes is encountered that does not form a valid character. |
|
31 |
.LP
|
|
32 |
.IP " *" 3 |
|
33 |
\fIlen\fP codes have been stored into the array pointed to by \fIdst\fP |
|
34 |
(and \fIdst\fP is not a null pointer). |
|
35 |
.LP
|
|
36 |
.LP
|
|
37 |
Each conversion shall take place as if by a call to the \fImbrtowc\fP() |
|
38 |
function. |
|
39 |
.LP
|
|
40 |
If \fIdst\fP is not a null pointer, the pointer object pointed to |
|
41 |
by \fIsrc\fP shall be assigned either a null pointer (if |
|
42 |
conversion stopped due to reaching a terminating null character) or |
|
43 |
the address just past the last character converted (if any). If |
|
44 |
conversion stopped due to reaching a terminating null character, and |
|
45 |
if \fIdst\fP is not a null pointer, the resulting state |
|
46 |
described shall be the initial conversion state. |
|
47 |
.LP
|
|
48 |
If \fIps\fP is a null pointer, the \fImbsrtowcs\fP() function shall |
|
49 |
use its own internal \fBmbstate_t\fP object, which is |
|
50 |
initialized at program start-up to the initial conversion state. Otherwise, |
|
51 |
the \fBmbstate_t\fP object pointed to by \fIps\fP |
|
52 |
shall be used to completely describe the current conversion state |
|
53 |
of the associated character sequence. The implementation behaves |
|
54 |
as if no function defined in this volume of IEEE\ Std\ 1003.1-2001 |
|
55 |
calls \fImbsrtowcs\fP(). |
|
56 |
.LP
|
|
57 |
The behavior of this function shall be affected by the \fILC_CTYPE\fP |
|
58 |
category of the current locale. |
|
59 |
.SH RETURN VALUE |
|
60 |
.LP
|
|
61 |
If the input conversion encounters a sequence of bytes that do not |
|
62 |
form a valid character, an encoding error occurs. In this |
|
63 |
case, the \fImbsrtowcs\fP() function stores the value of the macro |
|
64 |
[EILSEQ] in \fIerrno\fP and shall return (\fBsize_t\fP)-1; |
|
65 |
the conversion state is undefined. Otherwise, it shall return the |
|
66 |
number of characters successfully converted, not including the |
|
67 |
terminating null (if any). |
|
68 |
.SH ERRORS |
|
69 |
.LP
|
|
70 |
The \fImbsrtowcs\fP() function may fail if: |
|
71 |
.TP 7 |
|
72 |
.B EINVAL |
|
73 |
\fIps\fP points to an object that contains an invalid conversion state. |
|
74 |
.TP 7 |
|
75 |
.B EILSEQ |
|
76 |
Invalid character sequence is detected. |
|
77 |
.sp
|
|
78 |
.LP
|
|
79 |
\fIThe following sections are informative.\fP |
|
80 |
.SH EXAMPLES |
|
81 |
.LP
|
|
82 |
None. |
|
83 |
.SH APPLICATION USAGE |
|
84 |
.LP
|
|
85 |
None. |
|
86 |
.SH RATIONALE |
|
87 |
.LP
|
|
88 |
None. |
|
89 |
.SH FUTURE DIRECTIONS |
|
90 |
.LP
|
|
91 |
None. |
|
92 |
.SH SEE ALSO |
|
93 |
.LP
|
|
94 |
\fImbsinit\fP() , \fImbrtowc\fP() , the Base Definitions volume of |
|
95 |
IEEE\ Std\ 1003.1-2001, \fI<wchar.h>\fP |
|
96 |
.SH COPYRIGHT |
|
97 |
Portions of this text are reprinted and reproduced in electronic form |
|
98 |
from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology |
|
99 |
-- Portable Operating System Interface (POSIX), The Open Group Base |
|
100 |
Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of |
|
101 |
Electrical and Electronics Engineers, Inc and The Open Group. In the |
|
102 |
event of any discrepancy between this version and the original IEEE and |
|
103 |
The Open Group Standard, the original IEEE and The Open Group Standard |
|
104 |
is the referee document. The original Standard can be obtained online at |
|
105 |
http://www.opengroup.org/unix/online.html . |