void * memccpy

void * memccpy(void *, const void *, int, size_t)

The memccpy() function copies no more than len bytes from memory area src to memory area dest, stopping when the character val is found.

Remember:

The memccpy() function returns a pointer to the next character in dest after val, or NULL if val was not found in the first len characters of src.