memccpy - Untitled
Description: Untitled

Next: memchr, Previous: index, Up: Strings

### 5.5 `memccpy`—copy memory regions with end-token check

Synopsis

         #include <string.h>
         void* memccpy(void *restrict out, const void *restrict in,
             int endchar, size_t n);

Description
This function copies up to n bytes from the memory region pointed to by in to the memory region pointed to by out. If a byte matching the endchar is encountered, the byte is copied and copying stops.

If the regions overlap, the behavior is undefined.

Returns
`memccpy` returns a pointer to the first byte following the endchar in the out region. If no byte matching endchar was copied, then `NULL` is returned.

Portability
`memccpy` is a GNU extension.

`memccpy` requires no supporting OS subroutines.