Name
memmove - Copies characters between objects.
Syntax
#include <string.h>
void *memmove(dest, src, count)
void *dest;
const void *src;
size_t count;
Description
The memmove function copies count characters from src to
dest. If some regions of src and dest overlap, memmove
ensures that the original src bytes in the overlapping
region are copied before being overwritten.
Return Value
The value of dest, the destination object.
See Also
memccpy(S), memcpy(S)
Example
#include <stdio.h> #include <string.h>
char Source[] =
">>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<";
char Target[] = "We will copy the characters in here: "
"and will see if it correctly moves "
"in the string"; char *ToPrint;
main()
{
printf("Target Before: %s\n\n", Target);
ToPrint = memmove(&Target[32], Source,
sizeof(Source));
printf("Target After: %s\n", Target);
}
Using memmove, string Source is copied into string Target.
sizeof returns the size of the string, including the end-
of-string character, effectively shortening Target.
(printed 6/18/89)