HP C/iX Library Reference Manual (30026-90004)

Chapter 5 253
HP C/iX Library Function Descriptions
memccpy
memccpy
Copies characters from one memory location to another until a specified character is found
or until the specified count is reached.
Syntax
#include <memory.h>
char *memccpy (char *
s1
, char *
s2
, int
c
, int
n
)
Parameters
s1
A pointer to the target string.
s2
A pointer to the source string.
c
The character used to signal the end of the source string.
n
The number of bytes to be copied.
Return Values
x A character pointer to the first character in
s1
after
c
.
NULL The
c
parameter was not found in
s2
.
Description
The memccpy function copies characters from memory area
s2
into
s1
, stopping after the
first occurrence of
c
has been copied or after
n
characters have been copied, whichever
comes first. It returns a pointer to the character after the copy of
c
in
s1
, or a null pointer
if
c
was not found in the first
n
characters of
s2
. This function operates as efficiently as
possible on memory areas (arrays of characters bound by a count that are not terminated
by a null character). There is no check for the overflow of the destination memory area.
Character movement is performed differently in different implementations. Therefore,
avoid overlapping moves.
See Also
memcpy(), memcmp(), memchr()