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 only known to  the  wctomb  func‐
18       tion, and returns the length of said multibyte representation, i.e. the
19       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 non-trivial 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 non-zero if the encoding
36       has non-trivial shift state, or zero if the encoding is stateless.
37

CONFORMING TO

39       C99.
40

SEE ALSO

42       MB_CUR_MAX(3), wcrtomb(3), wcstombs(3)
43

NOTES

45       The behaviour of wctomb() depends on the LC_CTYPE category of the  cur‐
46       rent locale.
47
48       This function is not multi-thread safe. The function wcrtomb() provides
49       a better interface to the same functionality.
50
51
52
53GNU                               1999-07-25                         WCTOMB(3)
Impressum