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
11

NAME

13       wctomb — convert a wide-character code to a character
14

SYNOPSIS

16       #include <stdlib.h>
17
18       int wctomb(char *s, wchar_t wchar);
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‐2008
24       defers to the ISO C standard.
25
26       The  wctomb()  function  shall  determine the number of bytes needed to
27       represent the character corresponding to the wide-character code  whose
28       value  is  wchar  (including  any  change in the shift state). It shall
29       store the character representation (possibly  multiple  bytes  and  any
30       special  bytes to change shift state) in the array object pointed to by
31       s (if s is not a null pointer). At most  {MB_CUR_MAX}  bytes  shall  be
32       stored.  If  wchar  is  0, a null byte shall be stored, preceded by any
33       shift sequence needed to restore the initial shift state, and  wctomb()
34       shall be left in the initial shift state.
35
36       The  behavior  of this function is affected by the LC_CTYPE category of
37       the current locale. For a state-dependent encoding, this function shall
38       be  placed  into  its  initial  state by a call for which its character
39       pointer argument, s, is a null pointer.  Subsequent  calls  with  s  as
40       other  than  a null pointer shall cause the internal state of the func‐
41       tion to be altered as necessary. A call with s as a null pointer  shall
42       cause  this function to return a non-zero value if encodings have state
43       dependency, and 0 otherwise. Changing the LC_CTYPE category causes  the
44       shift state of this function to be unspecified.
45
46       The wctomb() function need not be thread-safe.
47
48       The  implementation shall behave as if no function defined in this vol‐
49       ume of POSIX.1‐2008 calls wctomb().
50

RETURN VALUE

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

ERRORS

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

EXAMPLES

70       None.
71

APPLICATION USAGE

73       None.
74

RATIONALE

76       None.
77

FUTURE DIRECTIONS

79       None.
80

SEE ALSO

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