| 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 wcsdup 3 2026-02-08 "Linux man-pages 6.18" |
| 8 |
.SH NAME |
| 9 |
wcsdup \- duplicate a 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 |
.BI "wchar_t *wcsdup(const wchar_t *" s ); |
| 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 wcsdup (): |
| 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 wcsdup () |
| 35 |
function is the wide-character equivalent |
| 36 |
of the |
| 37 |
.BR strdup (3) |
| 38 |
function. |
| 39 |
It allocates and returns a new wide-character string whose initial |
| 40 |
contents is a duplicate of the wide-character string pointed to by |
| 41 |
.IR s . |
| 42 |
.P |
| 43 |
Memory for the new wide-character string is |
| 44 |
obtained with |
| 45 |
.BR malloc (3), |
| 46 |
and should be freed with |
| 47 |
.BR free (3). |
| 48 |
.SH RETURN VALUE |
| 49 |
On success, |
| 50 |
.BR wcsdup () |
| 51 |
returns a pointer to the new wide-character string. |
| 52 |
On error, it returns NULL, with |
| 53 |
.I errno |
| 54 |
set to indicate the error. |
| 55 |
.SH ERRORS |
| 56 |
.TP |
| 57 |
.B ENOMEM |
| 58 |
Insufficient memory available to allocate duplicate string. |
| 59 |
.SH ATTRIBUTES |
| 60 |
For an explanation of the terms used in this section, see |
| 61 |
.BR attributes (7). |
| 62 |
.TS |
| 63 |
allbox; |
| 64 |
lbx lb lb |
| 65 |
l l l. |
| 66 |
Interface Attribute Value |
| 67 |
T{ |
| 68 |
.na |
| 69 |
.nh |
| 70 |
.BR wcsdup () |
| 71 |
T} Thread safety MT-Safe |
| 72 |
.TE |
| 73 |
.SH STANDARDS |
| 74 |
POSIX.1-2008. |
| 75 |
.SH HISTORY |
| 76 |
libc5, glibc 2.0. |
| 77 |
.SH SEE ALSO |
| 78 |
.BR strdup (3), |
| 79 |
.BR wcscpy (3) |