1MBSTOWCS(3P)               POSIX Programmer's Manual              MBSTOWCS(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       mbstowcs — convert a character string to a wide-character string
14

SYNOPSIS

16       #include <stdlib.h>
17
18       size_t mbstowcs(wchar_t *restrict pwcs, const char *restrict s,
19           size_t n);
20

DESCRIPTION

22       The functionality described on this reference page is aligned with  the
23       ISO C  standard.  Any  conflict between the requirements described here
24       and the ISO C standard is unintentional. This  volume  of  POSIX.1‐2008
25       defers to the ISO C standard.
26
27       The  mbstowcs()  function  shall  convert a sequence of characters that
28       begins in the initial shift state from the array pointed to by s into a
29       sequence of corresponding wide-character codes and shall store not more
30       than n wide-character codes into the array  pointed  to  by  pwcs.   No
31       characters  that  follow  a  null byte (which is converted into a wide-
32       character code with value 0) shall be examined or converted. Each char‐
33       acter  shall  be converted as if by a call to mbtowc(), except that the
34       shift state of mbtowc() is not affected.
35
36       No more than n elements shall be modified in the array  pointed  to  by
37       pwcs.   If copying takes place between objects that overlap, the behav‐
38       ior is undefined.
39
40       The behavior of this function shall be affected by the  LC_CTYPE  cate‐
41       gory  of  the  current  locale.   If pwcs is a null pointer, mbstowcs()
42       shall return the length required to convert the entire array regardless
43       of the value of n, but no values are stored.
44

RETURN VALUE

46       If  an  invalid  character  is  encountered,  mbstowcs()  shall  return
47       (size_t)−1 and shall set errno to indicate the error.
48
49       Otherwise, mbstowcs() shall return the number  of  the  array  elements
50       modified  (or  required if pwcs is null), not including a terminating 0
51       code, if any. The array shall  not  be  zero-terminated  if  the  value
52       returned is n.
53

ERRORS

55       The mbstowcs() function shall fail if:
56
57       EILSEQ An invalid byte sequence is detected.
58
59       The following sections are informative.
60

EXAMPLES

62       None.
63

APPLICATION USAGE

65       None.
66

RATIONALE

68       None.
69

FUTURE DIRECTIONS

71       None.
72

SEE ALSO

74       mblen(), mbtowc(), wctomb(), wcstombs()
75
76       The Base Definitions volume of POSIX.1‐2008, <stdlib.h>
77
79       Portions  of  this text are reprinted and reproduced in electronic form
80       from IEEE Std 1003.1, 2013 Edition, Standard for Information Technology
81       --  Portable  Operating  System  Interface (POSIX), The Open Group Base
82       Specifications Issue 7, Copyright (C) 2013 by the Institute of Electri‐
83       cal  and  Electronics  Engineers,  Inc  and  The  Open Group.  (This is
84       POSIX.1-2008 with the 2013 Technical Corrigendum  1  applied.)  In  the
85       event of any discrepancy between this version and the original IEEE and
86       The Open Group Standard, the original IEEE and The Open Group  Standard
87       is  the  referee document. The original Standard can be obtained online
88       at http://www.unix.org/online.html .
89
90       Any typographical or formatting errors that appear  in  this  page  are
91       most likely to have been introduced during the conversion of the source
92       files to man page format. To report such errors,  see  https://www.ker
93       nel.org/doc/man-pages/reporting_bugs.html .
94
95
96
97IEEE/The Open Group                  2013                         MBSTOWCS(3P)
Impressum