1WCTOMB(3P)                 POSIX Programmer's Manual                WCTOMB(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       wctomb — convert a wide-character code to a character
13

SYNOPSIS

15       #include <stdlib.h>
16
17       int wctomb(char *s, wchar_t wchar);
18

DESCRIPTION

20       The functionality described on this reference page is aligned with  the
21       ISO C  standard.  Any  conflict between the requirements described here
22       and the ISO C standard is unintentional. This  volume  of  POSIX.1‐2017
23       defers to the ISO C standard.
24
25       The  wctomb()  function  shall  determine the number of bytes needed to
26       represent the character corresponding to the wide-character code  whose
27       value  is  wchar  (including  any  change in the shift state). It shall
28       store the character representation (possibly  multiple  bytes  and  any
29       special  bytes to change shift state) in the array object pointed to by
30       s (if s is not a null pointer). At most  {MB_CUR_MAX}  bytes  shall  be
31       stored.  If  wchar  is  0, a null byte shall be stored, preceded by any
32       shift sequence needed to restore the initial shift state, and  wctomb()
33       shall be left in the initial shift state.
34
35       The  behavior  of this function is affected by the LC_CTYPE category of
36       the current locale. For a state-dependent encoding, this function shall
37       be  placed  into  its  initial  state by a call for which its character
38       pointer argument, s, is a null pointer.  Subsequent  calls  with  s  as
39       other  than  a null pointer shall cause the internal state of the func‐
40       tion to be altered as necessary. A call with s as a null pointer  shall
41       cause  this function to return a non-zero value if encodings have state
42       dependency, and 0 otherwise. Changing the LC_CTYPE category causes  the
43       shift state of this function to be unspecified.
44
45       The wctomb() function need not be thread-safe.
46
47       The  implementation shall behave as if no function defined in this vol‐
48       ume of POSIX.1‐2017 calls wctomb().
49

RETURN VALUE

51       If s is a null pointer, wctomb() shall return a non-zero or 0 value, if
52       character  encodings,  respectively,  do or do not have state-dependent
53       encodings. If s is not a null pointer, wctomb() shall return -1 if  the
54       value  of wchar does not correspond to a valid character, or return the
55       number of bytes that constitute  the  character  corresponding  to  the
56       value of wchar.
57
58       In  no  case  shall the value returned be greater than the value of the
59       {MB_CUR_MAX} macro.
60

ERRORS

62       The wctomb() function shall fail if:
63
64       EILSEQ An invalid wide-character code is detected.
65
66       The following sections are informative.
67

EXAMPLES

69       None.
70

APPLICATION USAGE

72       None.
73

RATIONALE

75       None.
76

FUTURE DIRECTIONS

78       None.
79

SEE ALSO

81       mblen(), mbtowc(), mbstowcs(), wcstombs()
82
83       The Base Definitions volume of POSIX.1‐2017, <stdlib.h>
84
86       Portions of this text are reprinted and reproduced in  electronic  form
87       from  IEEE Std 1003.1-2017, Standard for Information Technology -- Por‐
88       table Operating System Interface (POSIX), The Open Group Base  Specifi‐
89       cations  Issue  7, 2018 Edition, Copyright (C) 2018 by the Institute of
90       Electrical and Electronics Engineers, Inc and The Open Group.   In  the
91       event of any discrepancy between this version and the original IEEE and
92       The Open Group Standard, the original IEEE and The Open Group  Standard
93       is  the  referee document. The original Standard can be obtained online
94       at http://www.opengroup.org/unix/online.html .
95
96       Any typographical or formatting errors that appear  in  this  page  are
97       most likely to have been introduced during the conversion of the source
98       files to man page format. To report such errors,  see  https://www.ker
99       nel.org/doc/man-pages/reporting_bugs.html .
100
101
102
103IEEE/The Open Group                  2017                           WCTOMB(3P)
Impressum