1wctomb(3C) Standard C Library Functions wctomb(3C)
2
3
4
6 wctomb - convert a wide-character code to a character
7
9 #include <stdlib.h>
10
11 int wctomb(char *s, wchar_t wchar);
12
13
15 The wctomb() function determines the number of bytes needed to repre‐
16 sent the character corresponding to the wide-character code whose value
17 is wchar. It stores the character representation (possibly multiple
18 bytes) in the array object pointed to by s (if s is not a null
19 pointer). At most MB_CUR_MAX bytes are stored.
20
21
22 A call with s as a null pointer causes this function to return 0. The
23 behavior of this function is affected by the LC_CTYPE category of the
24 current locale.
25
27 If s is a null pointer, wctomb() returns 0 value. If s is not a null
28 pointer, wctomb() returns −1 if the value of wchar does not correspond
29 to a valid character, or returns the number of bytes that constitute
30 the character corresponding to the value of wchar.
31
32
33 In no case will the value returned be greater than the value of the
34 MB_CUR_MAX macro.
35
37 No errors are defined.
38
40 The wctomb() function can be used safely in a multithreaded applica‐
41 tion, as long as setlocale(3C) is not being called to change the
42 locale.
43
45 See attributes(5) for descriptions of the following attributes:
46
47
48
49
50 ┌─────────────────────────────┬─────────────────────────────┐
51 │ATTRIBUTE TYPE │ATTRIBUTE VALUE │
52 ├─────────────────────────────┼─────────────────────────────┤
53 │CSI │Enabled │
54 ├─────────────────────────────┼─────────────────────────────┤
55 │Interface Stability │Standard │
56 ├─────────────────────────────┼─────────────────────────────┤
57 │MT-Level │MT-Safe with exceptions │
58 └─────────────────────────────┴─────────────────────────────┘
59
61 mblen(3C), mbstowcs(3C), mbtowc(3C), setlocale(3C), wcstombs(3C),
62 attributes(5), standards(5)
63
64
65
66SunOS 5.11 14 Aug 2002 wctomb(3C)