localedef.1, access.2, ioctl_console.2, ioctl_fslabel.2, openat2.2, write.2, dlsym...
[man-pages.git] / man3 / wcswidth.3
blobec98cd631d08e6db6da7b3b7126359dc848a9acb
1 .\" Copyright (c) Bruno Haible <haible@clisp.cons.org>
2 .\"
3 .\" %%%LICENSE_START(GPLv2+_DOC_ONEPARA)
4 .\" This is free documentation; you can redistribute it and/or
5 .\" modify it under the terms of the GNU General Public License as
6 .\" published by the Free Software Foundation; either version 2 of
7 .\" the License, or (at your option) any later version.
8 .\" %%%LICENSE_END
9 .\"
10 .\" References consulted:
11 .\"   GNU glibc-2 source code and manual
12 .\"   Dinkumware C library reference http://www.dinkumware.com/
13 .\"   OpenGroup's Single UNIX specification http://www.UNIX-systems.org/online.html
14 .\"
15 .TH WCSWIDTH 3  2021-03-22 "GNU" "Linux Programmer's Manual"
16 .SH NAME
17 wcswidth \- determine columns needed for a fixed-size wide-character string
18 .SH SYNOPSIS
19 .nf
20 .BR "#define _XOPEN_SOURCE" "             /* See feature_test_macros(7) */"
21 .B #include <wchar.h>
22 .PP
23 .BI "int wcswidth(const wchar_t *" s ", size_t " n );
24 .fi
25 .SH DESCRIPTION
26 The
27 .BR wcswidth ()
28 function returns the
29 number of columns needed to represent
30 the wide-character string pointed to by
31 .IR s ,
32 but at most
33 .I n
34 wide
35 characters.
36 If a nonprintable wide character occurs among these characters,
37 \-1 is returned.
38 .SH RETURN VALUE
39 The
40 .BR wcswidth ()
41 function
42 returns the number of column positions for the
43 wide-character string
44 .IR s ,
45 truncated to at most length
46 .IR n .
47 .SH ATTRIBUTES
48 For an explanation of the terms used in this section, see
49 .BR attributes (7).
50 .ad l
51 .nh
52 .TS
53 allbox;
54 lbx lb lb
55 l l l.
56 Interface       Attribute       Value
58 .BR wcswidth ()
59 T}      Thread safety   MT-Safe locale
60 .TE
61 .hy
62 .ad
63 .sp 1
64 .SH CONFORMING TO
65 POSIX.1-2001, POSIX.1-2008.
66 .SH NOTES
67 The behavior of
68 .BR wcswidth ()
69 depends on the
70 .B LC_CTYPE
71 category of the
72 current locale.
73 .SH SEE ALSO
74 .BR iswprint (3),
75 .BR wcwidth (3)