Debian Codegraph @

upstream/debian-unstable/man3/wcsncpy.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 wcsncpy 3 2026-02-08 "Linux man-pages 6.18"
8 .SH NAME
9 wcsncpy \- copy a fixed-size string of wide characters
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 "wchar_t *wcsncpy(" "size_t n;"
18 .BI " wchar_t " dest "[restrict " n ],
19 .BI " const wchar_t *restrict " src ,
20 .BI " size_t " n );
21 .fi
22 .SH DESCRIPTION
23 The
24 .BR wcsncpy ()
25 function is the wide-character equivalent of the
26 .BR strncpy (3)
27 function.
28 It copies at most
29 .I n
30 wide characters from the wide-character
31 string pointed to by
32 .IR src ,
33 including the terminating null wide character (L\[aq]\[rs]0\[aq]),
34 to the array pointed to by
35 .IR dest .
36 Exactly
37 .I n
38 wide characters are
39 written at
40 .IR dest .
41 If the length
42 .I wcslen(src)
43 is smaller than
44 .IR n ,
45 the remaining wide characters in the array
46 pointed to by
47 .I dest
48 are filled
49 with null wide characters.
50 If the length
51 .I wcslen(src)
52 is greater than or equal to
53 .IR n ,
54 the string pointed to by
55 .I dest
56 will not be terminated by a null wide character.
57 .P
58 The strings may not overlap.
59 .P
60 The programmer must ensure that there is room for at least
61 .I n
62 wide
63 characters at
64 .IR dest .
65 .SH RETURN VALUE
66 .BR wcsncpy ()
67 returns
68 .IR dest .
69 .SH ATTRIBUTES
70 For an explanation of the terms used in this section, see
71 .BR attributes (7).
72 .TS
73 allbox;
74 lbx lb lb
75 l l l.
76 Interface Attribute Value
77 T{
78 .na
79 .nh
80 .BR wcsncpy ()
81 T} Thread safety MT-Safe
82 .TE
83 .SH STANDARDS
84 C11, POSIX.1-2008.
85 .SH HISTORY
86 POSIX.1-2001, C99.
87 .SH SEE ALSO
88 .BR strncpy (3)