Debian Codegraph @

upstream/debian-unstable/man3/wcswidth.3

raw
1 '\" t
2 .\" Copyright, Bruno Haible <[email protected]>
3 .\" Copyright, the authors of the Linux man-pages project
4 .\"
5 .\" SPDX-License-Identifier: GPL-2.0-or-later
6 .\"
7 .TH wcswidth 3 2026-02-08 "Linux man-pages 6.18"
8 .SH NAME
9 wcswidth \- determine columns needed for a fixed-size wide-character string
10 .SH LIBRARY
11 Standard C library
12 .RI ( libc ,\~ \-lc )
13 .SH SYNOPSIS
14 .nf
15 .BR "#define _XOPEN_SOURCE" " /* See feature_test_macros(7) */"
16 .B #include <wchar.h>
17 .P
18 .BI "int wcswidth(const wchar_t *" s ", size_t " n );
19 .fi
20 .SH DESCRIPTION
21 The
22 .BR wcswidth ()
23 function returns the
24 number of columns needed to represent
25 the wide-character string pointed to by
26 .IR s ,
27 but at most
28 .I n
29 wide
30 characters.
31 If a nonprintable wide character occurs among these characters,
32 \-1 is returned.
33 .SH RETURN VALUE
34 The
35 .BR wcswidth ()
36 function
37 returns the number of column positions for the
38 wide-character string
39 .IR s ,
40 truncated to at most length
41 .IR n .
42 .SH ATTRIBUTES
43 For an explanation of the terms used in this section, see
44 .BR attributes (7).
45 .TS
46 allbox;
47 lbx lb lb
48 l l l.
49 Interface Attribute Value
50 T{
51 .na
52 .nh
53 .BR wcswidth ()
54 T} Thread safety MT-Safe locale
55 .TE
56 .SH STANDARDS
57 POSIX.1-2008.
58 .SH HISTORY
59 POSIX.1-2001.
60 .SH NOTES
61 The behavior of
62 .BR wcswidth ()
63 depends on the
64 .B LC_CTYPE
65 category of the
66 current locale.
67 .SH SEE ALSO
68 .BR iswprint (3),
69 .BR wcwidth (3)