1wcwidth(3) Library Functions Manual wcwidth(3)
2
3
4
6 wcwidth - determine columns needed for a wide character
7
9 Standard C library (libc, -lc)
10
12 #define _XOPEN_SOURCE /* See feature_test_macros(7) */
13 #include <wchar.h>
14
15 int wcwidth(wchar_t c);
16
18 The wcwidth() function returns the number of columns needed to repre‐
19 sent the wide character c. If c is a printable wide character, the
20 value is at least 0. If c is null wide character (L'\0'), the value is
21 0. Otherwise, -1 is returned.
22
24 The wcwidth() function returns the number of column positions for c.
25
27 For an explanation of the terms used in this section, see at‐
28 tributes(7).
29
30 ┌─────────────────────────────────────┬───────────────┬────────────────┐
31 │Interface │ Attribute │ Value │
32 ├─────────────────────────────────────┼───────────────┼────────────────┤
33 │wcwidth() │ Thread safety │ MT-Safe locale │
34 └─────────────────────────────────────┴───────────────┴────────────────┘
35
37 POSIX.1-2008.
38
40 POSIX.1-2001.
41
42 Note that before glibc 2.2.5, glibc used the prototype
43
44 int wcwidth(wint_t c);
45
47 The behavior of wcwidth() depends on the LC_CTYPE category of the cur‐
48 rent locale.
49
51 iswprint(3), wcswidth(3)
52
53
54
55Linux man-pages 6.04 2023-03-30 wcwidth(3)