.TH memccpy() "" "" "String Function (libc)"
.PC "Copy a region of memory up to a set character"
.B "#include <string.h>"
\fBchar *memccpy(\fIdest\^\fB, \fIsrc\^\fB, \fIc\^\fB, \fIn\^\fB)\fR
\fBchar *\fIdest\^\fB, *\fIsrc\^\fB; unsigned int \fIc\^\fB, \fIn\^\fB;\fR
.PP
.II "character, copy"
.II "region of memory, copy"
.II "memory, copy"
.II "copy a region of memory"
.B memccpy()
copies characters from
.I src
to
.IR dest ,
stopping when either it finds the first occurrence of character
.I c
or it has copied
.I n
characters.
Unlike the routines
.B strcpy()
and
.BR strncpy() ,
.B memcpy()
copies from one region to another.
Therefore, it will not halt automatically when it encounters NUL.
.PP
.B memccpy()
returns a pointer to the first location after character
.I c
in
.IR dest ,
or NULL if character
.I c
was not found.
.SH "See Also"
.Xr "libc," libc
.Xr "memcpy()," memcpy
.Xr "strcpy()," strcpy
.Xr "strncpy()," strncpy
.Xr "string.h" string.h
.SH Notes
.B memccpy()
is not part of the \*(AS.
Use of this library routine may restrict portability.
.PP
If
.I dest
and
.I src
overlap, the behavior of
.B memccpy()
is undefined.
.I dest
should point to enough reserved memory to hold
.I n
bytes of data; otherwise, data corruption may result.
