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

DESCRIPTION

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

RETURN VALUE

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

ERRORS

51       The wcstombs() function shall fail if:
52
53       EILSEQ A wide-character code does not correspond to a valid character.
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()
71
72       The Base Definitions volume of POSIX.1‐2017, <stdlib.h>
73
75       Portions of this text are reprinted and reproduced in  electronic  form
76       from  IEEE Std 1003.1-2017, Standard for Information Technology -- Por‐
77       table Operating System Interface (POSIX), The Open Group Base  Specifi‐
78       cations  Issue  7, 2018 Edition, Copyright (C) 2018 by the Institute of
79       Electrical and Electronics Engineers, Inc and The Open Group.   In  the
80       event of any discrepancy between this version and the original IEEE and
81       The Open Group Standard, the original IEEE and The Open Group  Standard
82       is  the  referee document. The original Standard can be obtained online
83       at http://www.opengroup.org/unix/online.html .
84
85       Any typographical or formatting errors that appear  in  this  page  are
86       most likely to have been introduced during the conversion of the source
87       files to man page format. To report such errors,  see  https://www.ker
88       nel.org/doc/man-pages/reporting_bugs.html .
89
90
91
92IEEE/The Open Group                  2017                         WCSTOMBS(3P)
Impressum