WCSCPY(3) | Library Functions Manual | WCSCPY(3)

# NAME

`wcscpy`, `wcsncpy` — copy wide strings

# SYNOPSIS

`#include <wchar.h>`

wchar_t *
`wcscpy`(wchar_t * restrict dst, const wchar_t * restrict src);

wchar_t *
`wcsncpy`(wchar_t * restrict dst, const wchar_t * restrict src, size_t len);

# DESCRIPTION

The `wcscpy`() and `wcsncpy`() functions copy the wide string src to dst (including the terminating null wide character).

The `wcsncpy`() function copies not more than len wide characters to dst, appending null wide characters if the length of src is less than len, and not terminating dst if the length of src is greater than or equal to len.

If the src and dst strings overlap, the behavior is undefined.

# RETURN VALUES

The `wcscpy`() and `wcsncpy`() functions return dst.

# SEE ALSO

strcpy(3), strlcpy(3), wcscat(3), wcslcpy(3), wmemcpy(3), wmemmove(3)

# STANDARDS

The `wcscpy`() and `wcsncpy`() functions conform to ISO/IEC 9899:1999 (“ISO C99”) and were first introduced in ISO/IEC 9899/AMD1:1995 (“ISO C90, Amendment 1”).

# HISTORY

The `wcscpy`() and `wcsncpy`() functions were ported from NetBSD and first appeared in OpenBSD 3.8.

# CAVEATS

Using the functions `wcscpy`() and `wcsncpy`() is very error-prone with respect to buffer overflows; see the EXAMPLES section in strncpy(3) for correct usage. Using wcslcpy(3) is a better choice in most cases.

November 12, 2016 | Debian