Plan 9 from Bell Labs’s /usr/web/sources/contrib/fgb/root/sys/lib/ape/man/3/mbsrtowcs

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


.\" Copyright (c) 2001-2003 The Open Group, All Rights Reserved 
.TH "MBSRTOWCS" 3P 2003 "IEEE/The Open Group" "POSIX Programmer's Manual"
.\" mbsrtowcs 
.SH PROLOG
This manual page is part of the POSIX Programmer's Manual.
The Linux implementation of this interface may differ (consult
the corresponding Linux manual page for details of Linux behavior),
or the interface may not be implemented on Linux.
.SH NAME
mbsrtowcs \- convert a character string to a wide-character string
(restartable)
.SH SYNOPSIS
.LP
\fB#include <wchar.h>
.br
.sp
size_t mbsrtowcs(wchar_t *restrict\fP \fIdst\fP\fB, const char **restrict\fP
\fIsrc\fP\fB,
.br
\ \ \ \ \ \  size_t\fP \fIlen\fP\fB, mbstate_t *restrict\fP \fIps\fP\fB);
.br
\fP
.SH DESCRIPTION
.LP
The \fImbsrtowcs\fP() function shall convert a sequence of characters,
beginning in the conversion state described by the
object pointed to by \fIps\fP, from the array indirectly pointed to
by \fIsrc\fP into a sequence of corresponding wide
characters. If \fIdst\fP is not a null pointer, the converted characters
shall be stored into the array pointed to by \fIdst\fP.
Conversion continues up to and including a terminating null character,
which shall also be stored. Conversion shall stop early in
either of the following cases:
.IP " *" 3
A sequence of bytes is encountered that does not form a valid character.
.LP
.IP " *" 3
\fIlen\fP codes have been stored into the array pointed to by \fIdst\fP
(and \fIdst\fP is not a null pointer).
.LP
.LP
Each conversion shall take place as if by a call to the \fImbrtowc\fP()
function.
.LP
If \fIdst\fP is not a null pointer, the pointer object pointed to
by \fIsrc\fP shall be assigned either a null pointer (if
conversion stopped due to reaching a terminating null character) or
the address just past the last character converted (if any). If
conversion stopped due to reaching a terminating null character, and
if \fIdst\fP is not a null pointer, the resulting state
described shall be the initial conversion state.
.LP
If \fIps\fP is a null pointer, the \fImbsrtowcs\fP() function shall
use its own internal \fBmbstate_t\fP object, which is
initialized at program start-up to the initial conversion state. Otherwise,
the \fBmbstate_t\fP object pointed to by \fIps\fP
shall be used to completely describe the current conversion state
of the associated character sequence. The implementation behaves
as if no function defined in this volume of IEEE\ Std\ 1003.1-2001
calls \fImbsrtowcs\fP().
.LP
The behavior of this function shall be affected by the \fILC_CTYPE\fP
category of the current locale.
.SH RETURN VALUE
.LP
If the input conversion encounters a sequence of bytes that do not
form a valid character, an encoding error occurs. In this
case, the \fImbsrtowcs\fP() function stores the value of the macro
[EILSEQ] in \fIerrno\fP and shall return (\fBsize_t\fP)-1;
the conversion state is undefined. Otherwise, it shall return the
number of characters successfully converted, not including the
terminating null (if any).
.SH ERRORS
.LP
The \fImbsrtowcs\fP() function may fail if:
.TP 7
.B EINVAL
\fIps\fP points to an object that contains an invalid conversion state.
.TP 7
.B EILSEQ
Invalid character sequence is detected.
.sp
.LP
\fIThe following sections are informative.\fP
.SH EXAMPLES
.LP
None.
.SH APPLICATION USAGE
.LP
None.
.SH RATIONALE
.LP
None.
.SH FUTURE DIRECTIONS
.LP
None.
.SH SEE ALSO
.LP
\fImbsinit\fP(), \fImbrtowc\fP(), the Base Definitions volume of
IEEE\ Std\ 1003.1-2001, \fI<wchar.h>\fP
.SH COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form
from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
-- Portable Operating System Interface (POSIX), The Open Group Base
Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
Electrical and Electronics Engineers, Inc and The Open Group. In the
event of any discrepancy between this version and the original IEEE and
The Open Group Standard, the original IEEE and The Open Group Standard
is the referee document. The original Standard can be obtained online at
http://www.opengroup.org/unix/online.html .

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.