memccpy() — Copy bytes in memory

Format

#include <string.h>

void *memccpy(void *__restrict__s1, const void *__restrict__s2, int c, size_t n);

General description

The memccpy() function copies bytes from memory area s2 into memory area s1, stopping after the first occurrence of byte c (converted to an unsigned char) is copied, or after n bytes are copied, whichever comes first.

Returned value

If successful, memccpy() returns a pointer to the byte after the copy of c in s1.

If c was not found in the first n bytes of s2, memccpy() returns a NULL pointer.

Related Information