Debian Codegraph @

upstream/debian-unstable/man3/wcsnlen.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 wcsnlen 3 2026-02-08 "Linux man-pages 6.18"
8 .SH NAME
9 wcsnlen \- determine the length of a fixed-size wide-character string
10 .SH LIBRARY
11 Standard C library
12 .RI ( libc ,\~ \-lc )
13 .SH SYNOPSIS
14 .nf
15 .B #include <wchar.h>
16 .P
17 .BR "size_t wcsnlen(const wchar_t " s "[], size_t " maxlen );
18 .fi
19 .P
20 .RS -4
21 Feature Test Macro Requirements for glibc (see
22 .BR feature_test_macros (7)):
23 .RE
24 .P
25 .BR wcsnlen ():
26 .nf
27 Since glibc 2.10:
28 _POSIX_C_SOURCE >= 200809L
29 Before glibc 2.10:
30 _GNU_SOURCE
31 .fi
32 .SH DESCRIPTION
33 The
34 .BR wcsnlen ()
35 function is the wide-character equivalent
36 of the
37 .BR strnlen (3)
38 function.
39 It returns the number of wide-characters in the string pointed to by
40 .IR s ,
41 not including the terminating null wide character (L\[aq]\[rs]0\[aq]),
42 but at most
43 .I maxlen
44 wide characters (note: this parameter is not a byte count).
45 In doing this,
46 .BR wcsnlen ()
47 looks at only the first
48 .I maxlen
49 wide characters at
50 .I s
51 and never beyond
52 .IR s[maxlen\-1] .
53 .SH RETURN VALUE
54 The
55 .BR wcsnlen ()
56 function returns
57 .IR wcslen(s) ,
58 if that is less than
59 .IR maxlen ,
60 or
61 .I maxlen
62 if there is no null wide character among the
63 first
64 .I maxlen
65 wide characters pointed to by
66 .IR s .
67 .SH ATTRIBUTES
68 For an explanation of the terms used in this section, see
69 .BR attributes (7).
70 .TS
71 allbox;
72 lbx lb lb
73 l l l.
74 Interface Attribute Value
75 T{
76 .na
77 .nh
78 .BR wcsnlen ()
79 T} Thread safety MT-Safe
80 .TE
81 .SH STANDARDS
82 POSIX.1-2008.
83 .SH HISTORY
84 glibc 2.1.
85 .SH SEE ALSO
86 .BR strnlen (3),
87 .BR wcslen (3)