1wcswidth(3) Library Functions Manual wcswidth(3)
2
3
4
6 wcswidth - determine columns needed for a fixed-size wide-character
7 string
8
10 Standard C library (libc, -lc)
11
13 #define _XOPEN_SOURCE /* See feature_test_macros(7) */
14 #include <wchar.h>
15
16 int wcswidth(const wchar_t *s, size_t n);
17
19 The wcswidth() function returns the number of columns needed to repre‐
20 sent the wide-character string pointed to by s, but at most n wide
21 characters. If a nonprintable wide character occurs among these char‐
22 acters, -1 is returned.
23
25 The wcswidth() function returns the number of column positions for the
26 wide-character string s, truncated to at most length n.
27
29 For an explanation of the terms used in this section, see at‐
30 tributes(7).
31
32 ┌─────────────────────────────────────┬───────────────┬────────────────┐
33 │Interface │ Attribute │ Value │
34 ├─────────────────────────────────────┼───────────────┼────────────────┤
35 │wcswidth() │ Thread safety │ MT-Safe locale │
36 └─────────────────────────────────────┴───────────────┴────────────────┘
37
39 POSIX.1-2008.
40
42 POSIX.1-2001.
43
45 The behavior of wcswidth() depends on the LC_CTYPE category of the
46 current locale.
47
49 iswprint(3), wcwidth(3)
50
51
52
53Linux man-pages 6.05 2023-07-20 wcswidth(3)