MEMCPY - copy characters to non-overlapping string.

(ANSI Standard)

Usage:

#include <string.h>
ptr = memcpy( s1, s2, N );

Where:

void *s1;
points to an area of memory that is to receive the copied characters. This must be able to hold at least N characters.
const void *s2;
points to the string from which characters will be copied.
size_t N;
gives the number of characters to copy.
void *ptr;
points to the copied string (i.e. "s1").

Description:

"memcpy" copies exactly N characters from the string "s2" into the area of memory pointed to by "s1". Unlike the function "strncpy", "memcpy" does not check for the terminating '\0' of string "s2"; it simply copies N characters. It does not put a terminating '\0' on the end of string "s1".

Notes:

The current implementation of "memcpy" cannot handle the situation where the source string overlaps the destination string. For a copy function that is safe for overlapping strings, see "expl c lib memmove".

For efficiency, some calls to "memcpy" are performed in-line instead of with actual function calls. If you are examining your program with a debugger and put a breakpoint in "memcpy", the breakpoint will not catch the in-line uses of "memcpy".

See Also:

expl c lib strncpy

expl c lib strcpy

expl c lib memmove

Copyright © 1996, Thinkage Ltd.