DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

memmove(S)


memmove -- copies characters between objects

Syntax

cc . . . -lc

#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.

Example

   #include <stdio.h>
   #include <string.h>
   

char Source[] = ">>>>>>>>>><<<<<<<<<<"; char Target[] = "Copy the characters in here: " "to see if memmove 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.

See also

memccpy(S), memcpy(S)

Standards conformance

memmove is conformant with:

ANSI X3.159-1989 Programming Language -- C .


© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003