The Open Group Base Specifications Issue 7
IEEE Std 1003.1-2008, 2016 Edition
Copyright © 2001-2016 The IEEE and The Open Group

#### NAME

> wcsdup - duplicate a wide-character string

#### SYNOPSIS

> ``[CX] #include <wchar.h>
> wchar_t *wcsdup(const wchar_t *`string`);``
> `
> `

#### DESCRIPTION

> The wcsdup() function is the wide-character equivalent of the strdup() function.

> The wcsdup() function shall return a pointer to a new wide-character string, allocated as if by a call to malloc(), which is the duplicate of the wide-character string string. The returned pointer can be passed to free(). A null pointer is returned if the new wide-character string cannot be created.

#### RETURN VALUE

> Upon successful completion, the wcsdup() function shall return a pointer to the newly allocated wide-character string. Otherwise, it shall return a null pointer and set errno to indicate the error.

#### ERRORS

> The wcsdup() function shall fail if:

> [ENOMEM]
>   Memory large enough for the duplicate string could not be allocated.

The following sections are informative.

#### EXAMPLES

> None.

#### APPLICATION USAGE

> For functions that allocate memory as if by malloc(), the application should release such memory when it is no longer required by a call to free(). For wcsdup(), this is the return value.

#### RATIONALE

> None.

#### FUTURE DIRECTIONS

> None.

#### SEE ALSO

> free, strdup, wcscpy

> XBD <wchar.h>

#### CHANGE HISTORY

> First released in Issue 7.

End of informative text.

return to top of page

UNIX ® is a registered Trademark of The Open Group.
POSIX ® is a registered Trademark of The IEEE.
Copyright © 2001-2016 The IEEE and The Open Group, All Rights Reserved
[ Main Index | XBD | XSH | XCU | XRAT ]