| 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 wcpncpy 3 2026-02-08 "Linux man-pages 6.18" |
| 8 |
.SH NAME |
| 9 |
wcpncpy \- copy a fixed-size string of wide characters, |
| 10 |
returning a pointer to its end |
| 11 |
.SH LIBRARY |
| 12 |
Standard C library |
| 13 |
.RI ( libc ,\~ \-lc ) |
| 14 |
.SH SYNOPSIS |
| 15 |
.nf |
| 16 |
.B #include <wchar.h> |
| 17 |
.P |
| 18 |
.BR "wchar_t *wcpncpy(" "size_t n;" |
| 19 |
.BI " wchar_t " dest "[restrict " n ], |
| 20 |
.BI " const wchar_t *restrict " src , |
| 21 |
.BI " size_t " n ); |
| 22 |
.fi |
| 23 |
.P |
| 24 |
.RS -4 |
| 25 |
Feature Test Macro Requirements for glibc (see |
| 26 |
.BR feature_test_macros (7)): |
| 27 |
.RE |
| 28 |
.P |
| 29 |
.BR wcpncpy (): |
| 30 |
.nf |
| 31 |
Since glibc 2.10: |
| 32 |
_POSIX_C_SOURCE >= 200809L |
| 33 |
Before glibc 2.10: |
| 34 |
_GNU_SOURCE |
| 35 |
.fi |
| 36 |
.SH DESCRIPTION |
| 37 |
The |
| 38 |
.BR wcpncpy () |
| 39 |
function is the wide-character equivalent |
| 40 |
of the |
| 41 |
.BR stpncpy (3) |
| 42 |
function. |
| 43 |
It copies at most |
| 44 |
.I n |
| 45 |
wide characters from the wide-character |
| 46 |
string pointed to by |
| 47 |
.IR src , |
| 48 |
including the terminating null wide (L\[aq]\[rs]0\[aq]), |
| 49 |
to the array pointed to by |
| 50 |
.IR dest . |
| 51 |
Exactly |
| 52 |
.I n |
| 53 |
wide characters are |
| 54 |
written at |
| 55 |
.IR dest . |
| 56 |
If the length |
| 57 |
.I wcslen(src) |
| 58 |
is smaller than |
| 59 |
.IR n , |
| 60 |
the remaining wide characters in the array pointed to |
| 61 |
by |
| 62 |
.I dest |
| 63 |
are filled with L\[aq]\[rs]0\[aq] characters. |
| 64 |
If the length |
| 65 |
.I wcslen(src) |
| 66 |
is greater than or equal |
| 67 |
to |
| 68 |
.IR n , |
| 69 |
the string pointed to by |
| 70 |
.I dest |
| 71 |
will |
| 72 |
not be L\[aq]\[rs]0\[aq] terminated. |
| 73 |
.P |
| 74 |
The strings may not overlap. |
| 75 |
.P |
| 76 |
The programmer must ensure that there is room for at least |
| 77 |
.I n |
| 78 |
wide |
| 79 |
characters at |
| 80 |
.IR dest . |
| 81 |
.SH RETURN VALUE |
| 82 |
.BR wcpncpy () |
| 83 |
returns a pointer to |
| 84 |
one past the last non-null wide character written, |
| 85 |
that is, |
| 86 |
.IR dest\~+\~wcsnlen(src,\~n) . |
| 87 |
.SH ATTRIBUTES |
| 88 |
For an explanation of the terms used in this section, see |
| 89 |
.BR attributes (7). |
| 90 |
.TS |
| 91 |
allbox; |
| 92 |
lbx lb lb |
| 93 |
l l l. |
| 94 |
Interface Attribute Value |
| 95 |
T{ |
| 96 |
.na |
| 97 |
.nh |
| 98 |
.BR wcpncpy () |
| 99 |
T} Thread safety MT-Safe |
| 100 |
.TE |
| 101 |
.SH STANDARDS |
| 102 |
POSIX.1-2008. |
| 103 |
.SH SEE ALSO |
| 104 |
.BR stpncpy (3), |
| 105 |
.BR wcsncpy (3) |