1WCSTOMBS(3P)               POSIX Programmer's Manual              WCSTOMBS(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       wcstombs - convert a wide-character string to a character string
13

SYNOPSIS

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

DESCRIPTION

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

RETURN VALUE

43       If a wide-character code is encountered that does not correspond  to  a
44       valid  character  (of  one or more bytes each), wcstombs() shall return
45       (size_t)-1. Otherwise, wcstombs() shall  return  the  number  of  bytes
46       stored in the character array, not including any terminating null byte.
47       The array shall not be null-terminated if the value returned is n.
48

ERRORS

50       The wcstombs() function may fail if:
51
52       EILSEQ A wide-character code does not correspond to a valid character.
53
54
55       The following sections are informative.
56

EXAMPLES

58       None.
59

APPLICATION USAGE

61       None.
62

RATIONALE

64       None.
65

FUTURE DIRECTIONS

67       None.
68

SEE ALSO

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