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

NAME

6       wcstombs - convert a wide-character string to a character string
7

SYNOPSIS

9       #include <stdlib.h>
10
11       size_t wcstombs(char *restrict s, const wchar_t *restrict pwcs,
12              size_t n);
13
14

DESCRIPTION

16       The  wcstombs()  function  shall convert the sequence of wide-character
17       codes that are in the array pointed to by pwcs into a sequence of char‐
18       acters  that  begins in the initial shift state and store these charac‐
19       ters into the array pointed to by s,  stopping  if  a  character  would
20       exceed  the  limit  of  n total bytes or if a null byte is stored. Each
21       wide-character code shall be converted as if by  a  call  to  wctomb(),
22       except that the shift state of wctomb() shall not be affected.
23
24       The  behavior  of this function shall be affected by the LC_CTYPE cate‐
25       gory of the current locale.
26
27       No more than n bytes shall be modified in the array pointed to by s. If
28       copying takes place between objects that overlap, the behavior is unde‐
29       fined.    If s is a null pointer, wcstombs() shall  return  the  length
30       required  to convert the entire array regardless of the value of n, but
31       no values are stored.
32
33       The wcstombs() function need not be reentrant. A function that  is  not
34       required to be reentrant is not required to be thread-safe.
35

RETURN VALUE

37       If  a  wide-character code is encountered that does not correspond to a
38       valid character (of one or more bytes each),  wcstombs()  shall  return
39       (size_t)-1.  Otherwise,  wcstombs()  shall  return  the number of bytes
40       stored in the character array, not including any terminating null byte.
41       The array shall not be null-terminated if the value returned is n.
42

ERRORS

44       The wcstombs() function may fail if:
45
46       EILSEQ A wide-character code does not correspond to a valid character.
47
48
49       The following sections are informative.
50

EXAMPLES

52       None.
53

APPLICATION USAGE

55       None.
56

RATIONALE

58       None.
59

FUTURE DIRECTIONS

61       None.
62

SEE ALSO

64       mblen()  , mbtowc() , mbstowcs() , wctomb() , the Base Definitions vol‐
65       ume of IEEE Std 1003.1-2001, <stdlib.h>
66
68       Portions of this text are reprinted and reproduced in  electronic  form
69       from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
70       -- Portable Operating System Interface (POSIX),  The  Open  Group  Base
71       Specifications  Issue  6,  Copyright  (C) 2001-2003 by the Institute of
72       Electrical and Electronics Engineers, Inc and The Open  Group.  In  the
73       event of any discrepancy between this version and the original IEEE and
74       The Open Group Standard, the original IEEE and The Open Group  Standard
75       is  the  referee document. The original Standard can be obtained online
76       at http://www.opengroup.org/unix/online.html .
77
78
79
80IEEE/The Open Group                  2003                          WCSTOMBS(P)
Impressum