DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

memmove(S-osr5)


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-osr5), memcpy(S-osr5)

Standards conformance

memmove is conformant with:

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


© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 02 June 2005