Format
#include <wchar.h> wchar_t *wmemmove(wchar_t *s1, const wchar_t *s2, size_t n);
Language Level: ANSI
Threadsafe: Yes.
Description
The wmemmove() function copies n wide characters from the object pointed to by s2 to the object pointed to by s1. Copying takes place as if the n wide characters from the object pointed to by s2 are first copied into a temporary array, of n wide characters, that does not overlap the objects pointed to by s1 or s2. Then, the wmemmove() function copies the n wide characters from the temporary array into the object pointed to by s1. If n has the value 0, the wmemmove() function copies 0 wide characters.
Return Value
The wmemmove() function returns the value of s1.
Example that uses wmemmove()
This example copies the first five characters in a string to overlay the last five characters in the same string. Since the string is only nine characters long, the source and target overlap.
#include <wchar.h> #include <stdio.h> void main() { wchar_t *theString = L"ABCDEFGHI"; printf("\nThe original string: %ls \n", theString); wmemmove(theString+4, theString, 5); printf("\nThe string after wmemmove: %ls \n", theString); return; /******************************************************** The output should be: The original string: ABCDEFGHI The string after wmemmove: ABCDABCDE ********************************************************/ }
Related Information
(C) Copyright IBM Corporation 1992, 2006. All Rights Reserved.