Format
#include <wchar.h> wchar_t *wmemcpy(wchar_t *s1, const wchar_t *s2, size_t n);
Language Level: ANSI 93
wmemcpy copies n wide characters from the object pointed to
by s2 to the object pointed to by s1.
If s1 and s2 overlap, the result of the copy is unpredictable. If n has the value 0, wmemcpy copies 0 wide characters.
Return Value
wmemcpy returns the value of s1.
Example
This example copies the first four characters from
out to in. In the expected output, the first four
characters in both strings will be "ABCD".
#include <wchar.h> #include <stdio.h>
main()
{
wchar_t *in = L"12345678";
wchar_t *out = L"ABCDEFGH";
wchar_t *ptr;
printf("\nExpected result: First 4 chars of in change");
printf(" and are the same as first 4 chars of out");
ptr = wmemcpy(in, out, 4);
if (ptr == in)
printf("\nArray in %ls array out %ls \n", in, out);
else
{
printf("\n*** ERROR ***");
printf(" returned pointer wrong");
}
}
![]()
memcpy -- Copy Bytes
memccpy -- Copy
Bytes
strcpy -- Copy
Strings
strncpy -- Copy
Strings
wcscpy -- Copy
Wide-Character Strings
wcsncpy -- Copy
Wide-Character Strings
wmemchr -- Locate
Wide Character in Wide-Character String
wmemcmp -- Compare
Wide-Character Strings
wmemmove -- Copy
Wide-Character Strings
wmemset -- Set Wide
Characters to Value
<wchar.h>