Index of Section 3 Manual Pages
| Interix / SUA | wcscpy.3 | Interix / SUA |
wcscpy(3) wcscpy(3)
wcscpy()
NAME
wcscpy(), wcslcpy(), wcsncpy() - copy wide-character strings
SYNOPSIS
#include
wchar_t * wcscpy (wchar_t *dst, const wchar_t *src)
size_t wcslcpy (wchar_t *dst, const wchar_t *src, size_t len)
wchar_t * wcsncpy (wchar_t *dst, const wchar_t *src, size_t len)
DESCRIPTION
The wcscpy(3) and wcsncpy(3) functions copy the wide-character string src
to dst (including the terminating \0 wide-character code).
The wcsncpy(3) copies no more than len characters into dst, appending \0
wide-character codes if src is less than len characters long, and not
terminating dst if src is more than len characters long.
The wcslcpy(3) function is designed to be a safer, more consistent, and
less error prone replacement for the wcsncpy(3) function. Unlike the
wcsncpy(3) function, wcslcpy(3) takes the full size of the buffer (not
just the length) and guaranteees to NUL-terminate the result (as long as
len is at larger than 0 or as long as there is at least one wide-character
column free in dst. Note that wcslcpy(3) only operates on true wide-
character strings. This means that src must be NUL-terminated.
RETURN VALUES
The wcscpy(3) and wcsncpy(3) functions return dst. The wcslcpy(3) function
returns the number of wide-characters copied to dst, not including the NUL
terminator.
EXAMPLES
The following sets chararray to abc\0\0\0:
(void)wcsncpy(chararray, "abc", 6).
The following sets chararray to abcdef:
(void)wcsncpy(chararray, "abcdefgh", 6);
SEE ALSO
bcopy(3)
memcpy(3)
memmove(3)
USAGE NOTES
All of these functions are thread safe.
None of these functions are async-signal safe.