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

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 "WCSRTOMBS" 3P 2003 "IEEE/The Open Group" "POSIX Programmer's Manual"
.\" wcsrtombs 
.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
wcsrtombs \- convert a wide-character string to a character string
(restartable)
.SH SYNOPSIS
.LP
\fB#include <wchar.h>
.br
.sp
size_t wcsrtombs(char *restrict\fP \fIdst\fP\fB, const wchar_t **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 \fIwcsrtombs\fP() function shall convert a sequence of wide characters
from the array indirectly pointed to by \fIsrc\fP
into a sequence of corresponding characters, beginning in the conversion
state described by the object pointed to by \fIps\fP. If
\fIdst\fP is not a null pointer, the converted characters shall then
be stored into the array pointed to by \fIdst\fP. Conversion
continues up to and including a terminating null wide character, which
shall also be stored. Conversion shall stop earlier in the
following cases:
.IP " *" 3
When a code is reached that does not correspond to a valid character
.LP
.IP " *" 3
When the next character would exceed the limit of \fIlen\fP total
bytes to be stored in 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 \fIwcrtomb\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 wide character)
or the address just past the last wide character converted
(if any). If conversion stopped due to reaching a terminating null
wide character, the resulting state described shall be the
initial conversion state.
.LP
If \fIps\fP is a null pointer, the \fIwcsrtombs\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 shall
behave as if no function defined in this volume of IEEE\ Std\ 1003.1-2001
calls \fIwcsrtombs\fP().
.LP
If
the application uses any of the _POSIX_THREAD_SAFE_FUNCTIONS or _POSIX_THREADS
functions, the application shall ensure that the
\fIwcsrtombs\fP() function is called with a non-NULL \fIps\fP argument.
.LP
The behavior of this function shall be affected by the \fILC_CTYPE\fP
category of the current locale.
.SH RETURN VALUE
.LP
If conversion stops because a code is reached that does not correspond
to a valid character, an encoding error occurs. In this
case, the \fIwcsrtombs\fP() function shall store the value of the
macro [EILSEQ] in \fIerrno\fP and return (\fBsize_t\fP)-1; the
conversion state is undefined. Otherwise, it shall return the number
of bytes in the resulting character sequence, not including
the terminating null (if any).
.SH ERRORS
.LP
The \fIwcsrtombs\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
A wide-character code does not correspond to a valid character.
.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(), \fIwcrtomb\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.