1WCTOMB(3) Linux Programmer's Manual WCTOMB(3)
2
3
4
6 wctomb - convert a wide character to a multibyte sequence
7
9 #include <stdlib.h>
10
11 int wctomb(char *s, wchar_t wc);
12
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 only known 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, only known
25 to this function, to the initial state, and returns non-zero if the
26 encoding has nontrivial shift state, or zero if the encoding is state‐
27 less.
28
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 non-zero if the encoding
36 has nontrivial shift state, or zero if the encoding is stateless.
37
39 C99.
40
42 The behavior of wctomb() depends on the LC_CTYPE category of the cur‐
43 rent locale.
44
45 This function is not multithread safe. The function wcrtomb(3) pro‐
46 vides a better interface to the same functionality.
47
49 MB_CUR_MAX(3), wcrtomb(3), wcstombs(3)
50
52 This page is part of release 3.22 of the Linux man-pages project. A
53 description of the project, and information about reporting bugs, can
54 be found at http://www.kernel.org/doc/man-pages/.
55
56
57
58GNU 1999-07-25 WCTOMB(3)