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
11

NAME

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

SYNOPSIS

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

DESCRIPTION

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

RETURN VALUE

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

ERRORS

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

EXAMPLES

99       None.
100

APPLICATION USAGE

102       None.
103

RATIONALE

105       None.
106

FUTURE DIRECTIONS

108       None.
109

SEE ALSO

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