OpenBSD manual page server

Manual Page Search Parameters

WCSCPY(3) Library Functions Manual WCSCPY(3)

wcscpy, wcsncpycopy wide strings

#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);

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

The () function copies not more than len wide characters to dst, appending null wide characters if the length of src is less than len, and 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.

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

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

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”).

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

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 OpenBSD-7.6