1WCTOMB(3)                  Linux Programmer's Manual                 WCTOMB(3)
2
3
4

NAME

6       wctomb - convert a wide character to a multibyte sequence
7

SYNOPSIS

9       #include <stdlib.h>
10
11       int wctomb(char *s, wchar_t wc);
12

DESCRIPTION

14       If  s is not NULL, the wctomb() function converts the wide character wc
15       to its multibyte representation and stores it at the beginning  of  the
16       character  array pointed to by s.  It updates the shift state, which is
17       stored in a static anonymous variable known only to the wctomb()  func‐
18       tion, and returns the length of said multibyte representation, that is,
19       the number of bytes written at s.
20
21       The programmer must ensure that there is room for at  least  MB_CUR_MAX
22       bytes at s.
23
24       If  s is NULL, the wctomb() function resets the shift state, known only
25       to this function, to the initial state, and returns nonzero if the  en‐
26       coding  has  nontrivial  shift state, or zero if the encoding is state‐
27       less.
28

RETURN VALUE

30       If s is not NULL, the wctomb() function returns  the  number  of  bytes
31       that have been written to the byte array at s.  If wc can not be repre‐
32       sented as a multibyte sequence (according to the current locale), -1 is
33       returned.
34
35       If s is NULL, the wctomb() function returns nonzero if the encoding has
36       nontrivial shift state, or zero if the encoding is stateless.
37

ATTRIBUTES

39       For an  explanation  of  the  terms  used  in  this  section,  see  at‐
40       tributes(7).
41
42       ┌─────────────────────────────────────┬───────────────┬────────────────┐
43Interface                            Attribute     Value          
44       ├─────────────────────────────────────┼───────────────┼────────────────┤
45wctomb()                             │ Thread safety │ MT-Unsafe race │
46       └─────────────────────────────────────┴───────────────┴────────────────┘
47

CONFORMING TO

49       POSIX.1-2001, POSIX.1-2008, C99.
50

NOTES

52       The  behavior  of wctomb() depends on the LC_CTYPE category of the cur‐
53       rent locale.
54
55       The function wcrtomb(3) provides a better interface to the  same  func‐
56       tionality.
57

SEE ALSO

59       MB_CUR_MAX(3),   mblen(3),   mbstowcs(3),  mbtowc(3),  wcrtomb(3),  wc‐
60       stombs(3)
61

COLOPHON

63       This page is part of release 5.13 of the Linux  man-pages  project.   A
64       description  of  the project, information about reporting bugs, and the
65       latest    version    of    this    page,    can     be     found     at
66       https://www.kernel.org/doc/man-pages/.
67
68
69
70GNU                               2021-03-22                         WCTOMB(3)
Impressum