1mbsrtowcs(3C)            Standard C Library Functions            mbsrtowcs(3C)
2
3
4

NAME

6       mbsrtowcs  -  convert  a  character  string  to a wide-character string
7       (restartable)
8

SYNOPSIS

10       #include <wchar.h>
11
12       size_t mbsrtowcs(wchar_t *restrict dst, const char **restrict src,
13            size_t len, mbstate_t *restrict ps);
14
15

DESCRIPTION

17       The mbsrtowcs() function converts a sequence of  characters,  beginning
18       in  the conversion state described by the object pointed to by ps, from
19       the array indirectly pointed to by src into a sequence of corresponding
20       wide-characters. If dst is not a null pointer, the converted characters
21       are stored into the array pointed to by  dst. Conversion  continues  up
22       to  and  including  a terminating null character, which is also stored.
23       Conversion stops early in either of the following cases:
24
25           o      When a sequence of bytes is encountered that does not form a
26                  valid character.
27
28           o      When len codes have been stored into the array pointed to by
29                  dst (and  dst is not a null pointer).
30
31
32       Each conversion takes place as if by a call to the mbrtowc() function.
33
34
35       If dst is not a null pointer, the pointer object pointed to by  src  is
36       assigned either a null pointer (if conversion stopped due to reaching a
37       terminating null character) or the address just past the last character
38       converted  (if any).  If conversion stopped due to reaching a terminat‐
39       ing null character, and if dst is not a  null  pointer,  the  resulting
40       state described is the initial conversion state.
41
42
43       If ps is a null pointer, the mbsrtowcs() function uses its own internal
44       mbstate_t object, which is initialized at program startup to  the  ini‐
45       tial  conversion state.  Otherwise, the  mbstate_t object pointed to by
46       ps is used to completely describe the current conversion state  of  the
47       associated  character  sequence.  Solaris will behave as if no function
48       defined in the Solaris Reference Manual calls mbsrtowcs().
49
50
51       The behavior of this function is affected by the LC_CTYPE  category  of
52       the current locale.  See environ(5).
53

RETURN VALUES

55       If the input conversion encounters a sequence of bytes that do not form
56       a valid character, an encoding error occurs.  In this case,  the  mbsr‐
57       towcs()  function  stores  the  value  of the macro EILSEQ in errno and
58       returns (size_t)−1; the conversion state is undefined.   Otherwise,  it
59       returns  the number of characters successfully converted, not including
60       the terminating null (if any).
61

ERRORS

63       The mbsrtowcs() function may fail if:
64
65       EINVAL    The ps argument points to an object that contains an  invalid
66                 conversion state.
67
68
69       EILSEQ    Invalid character sequence is detected.
70
71

ATTRIBUTES

73       See attributes(5) for descriptions of the following attributes:
74
75
76
77
78       ┌─────────────────────────────┬─────────────────────────────┐
79       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
80       ├─────────────────────────────┼─────────────────────────────┤
81       │Interface Stability          │Standard                     │
82       ├─────────────────────────────┼─────────────────────────────┤
83       │MT-Level                     │See NOTES below              │
84       └─────────────────────────────┴─────────────────────────────┘
85

SEE ALSO

87       mbrtowc(3C),  mbsinit(3C),  setlocale(3C),  attributes(5),  environ(5),
88       standards(5)
89

NOTES

91       If ps is not a null pointer,  mbsrtowcs()  uses  the  mbstate_t  object
92       pointed  to  by ps and the function can be used safely in multithreaded
93       applications, as long as setlocale(3C) is not being  called  to  change
94       the  locale.  If  ps  is  a null pointer, mbsrtowcs() uses its internal
95       mbstate_t object and the function is Unsafe in  multithreaded  applica‐
96       tions.
97
98
99
100SunOS 5.11                        1 Nov 2003                     mbsrtowcs(3C)
Impressum