1WCSWIDTH(3) Linux Programmer's Manual WCSWIDTH(3)
2
3
4
6 wcswidth - determine columns needed for a fixed-size wide-character
7 string
8
10 #define _XOPEN_SOURCE /* See feature_test_macros(7) */
11 #include <wchar.h>
12
13 int wcswidth(const wchar_t *s, size_t n);
14
16 The wcswidth() function returns the number of columns needed to repre‐
17 sent the wide-character string pointed to by s, but at most n wide
18 characters. If a nonprintable wide character occurs among these char‐
19 acters, -1 is returned.
20
22 The wcswidth() function returns the number of column positions for the
23 wide-character string s, truncated to at most length n.
24
26 For an explanation of the terms used in this section, see at‐
27 tributes(7).
28
29 ┌─────────────────────────────────────┬───────────────┬────────────────┐
30 │Interface │ Attribute │ Value │
31 ├─────────────────────────────────────┼───────────────┼────────────────┤
32 │wcswidth() │ Thread safety │ MT-Safe locale │
33 └─────────────────────────────────────┴───────────────┴────────────────┘
34
36 POSIX.1-2001, POSIX.1-2008.
37
39 The behavior of wcswidth() depends on the LC_CTYPE category of the cur‐
40 rent locale.
41
43 iswprint(3), wcwidth(3)
44
46 This page is part of release 5.12 of the Linux man-pages project. A
47 description of the project, information about reporting bugs, and the
48 latest version of this page, can be found at
49 https://www.kernel.org/doc/man-pages/.
50
51
52
53GNU 2021-03-22 WCSWIDTH(3)