1WCSRTOMBS(3P)              POSIX Programmer's Manual             WCSRTOMBS(3P)
2
3
4

PROLOG

6       This  manual  page is part of the POSIX Programmer's Manual.  The Linux
7       implementation of this interface may differ (consult the  corresponding
8       Linux  manual page for details of Linux behavior), or the interface may
9       not be implemented on Linux.
10

NAME

12       wcsnrtombs, wcsrtombs — convert a wide-character string to a  character
13       string (restartable)
14

SYNOPSIS

16       #include <wchar.h>
17
18       size_t wcsnrtombs(char *restrict dst, const wchar_t **restrict src,
19           size_t nwc, size_t len, mbstate_t *restrict ps);
20       size_t wcsrtombs(char *restrict dst, const wchar_t **restrict src,
21           size_t len, mbstate_t *restrict ps);
22

DESCRIPTION

24       For  wcsrtombs(): The functionality described on this reference page is
25       aligned with the ISO C standard. Any conflict between the  requirements
26       described  here and the ISO C standard is unintentional. This volume of
27       POSIX.1‐2017 defers to the ISO C standard.
28
29       The wcsrtombs() function shall convert a sequence  of  wide  characters
30       from  the  array indirectly pointed to by src into a sequence of corre‐
31       sponding characters, beginning in the conversion state described by the
32       object  pointed  to by ps.  If dst is not a null pointer, the converted
33       characters shall then be stored into the array pointed to by dst.  Con‐
34       version  continues  up to and including a terminating null wide charac‐
35       ter, which shall also be stored. Conversion shall stop earlier  in  the
36       following cases:
37
38        *  When  a code is reached that does not correspond to a valid charac‐
39           ter
40
41        *  When the next character would exceed the limit of len  total  bytes
42           to  be stored in the array pointed to by dst (and dst is not a null
43           pointer)
44
45       Each conversion shall take place as if by a call to the wcrtomb() func‐
46       tion.
47
48       If  dst  is  not  a  null pointer, the pointer object pointed to by src
49       shall be assigned either a null pointer (if conversion stopped  due  to
50       reaching  a  terminating  null wide character) or the address just past
51       the last wide character converted (if any). If conversion  stopped  due
52       to  reaching  a  terminating  null  wide character, the resulting state
53       described shall be the initial conversion state.
54
55       If ps is a null pointer, the wcsrtombs() function  shall  use  its  own
56       internal  mbstate_t object, which is initialized at program start-up to
57       the initial conversion state. Otherwise, the mbstate_t  object  pointed
58       to  by  ps  shall be used to completely describe the current conversion
59       state of the associated character sequence.
60
61       The wcsnrtombs() and wcsrtombs() functions need not be  thread-safe  if
62       called with a NULL ps argument.
63
64       The  wcsnrtombs() function shall be equivalent to the wcsrtombs() func‐
65       tion, except that the conversion is limited to the first nwc wide char‐
66       acters.
67
68       The  wcsrtombs() function shall not change the setting of errno if suc‐
69       cessful.
70
71       The behavior of these functions shall be affected by the LC_CTYPE cate‐
72       gory of the current locale.
73
74       The  implementation  shall  behave  as if no function defined in System
75       Interfaces volume of POSIX.1‐2017 calls these functions.
76

RETURN VALUE

78       If conversion stops because a code is reached that does not  correspond
79       to  a  valid  character,  an encoding error occurs. In this case, these
80       functions shall store the value of the  macro  [EILSEQ]  in  errno  and
81       return (size_t)-1; the conversion state is undefined.  Otherwise, these
82       functions shall return the number of bytes in the  resulting  character
83       sequence, not including the terminating null (if any).
84

ERRORS

86       These functions shall fail if:
87
88       EILSEQ A wide-character code does not correspond to a valid character.
89
90       These functions may fail if:
91
92       EINVAL ps  points  to  an  object  that  contains an invalid conversion
93              state.
94
95       The following sections are informative.
96

EXAMPLES

98       None.
99

APPLICATION USAGE

101       None.
102

RATIONALE

104       None.
105

FUTURE DIRECTIONS

107       None.
108

SEE ALSO

110       mbsinit(), wcrtomb()
111
112       The Base Definitions volume of POSIX.1‐2017, <wchar.h>
113
115       Portions of this text are reprinted and reproduced in  electronic  form
116       from  IEEE Std 1003.1-2017, Standard for Information Technology -- Por‐
117       table Operating System Interface (POSIX), The Open Group Base  Specifi‐
118       cations  Issue  7, 2018 Edition, Copyright (C) 2018 by the Institute of
119       Electrical and Electronics Engineers, Inc and The Open Group.   In  the
120       event of any discrepancy between this version and the original IEEE and
121       The Open Group Standard, the original IEEE and The Open Group  Standard
122       is  the  referee document. The original Standard can be obtained online
123       at http://www.opengroup.org/unix/online.html .
124
125       Any typographical or formatting errors that appear  in  this  page  are
126       most likely to have been introduced during the conversion of the source
127       files to man page format. To report such errors,  see  https://www.ker
128       nel.org/doc/man-pages/reporting_bugs.html .
129
130
131
132IEEE/The Open Group                  2017                        WCSRTOMBS(3P)
Impressum