MEMMEM(3)

NAME
memmem - find memory segment

SYNOPSIS

#include <string.h>

void *memmem(const void *s1, size_t l1, const void *s2, size_t l2);

DESCRIPTION

Locates the first occurrence in the memory region pointed to by s1 with length l1 of the sequence of bytes pointed to by s2 of length l2. If you already know the lengths of your haystack and needle, memmem is much faster than strstr.

RETURNS

Returns a pointer to the located segment, or a null pointer if s2 is not found. If l2 is 0, s1 is returned.

PORTABILITY

memmem is a newlib extension.

memmem requires no supporting OS subroutines.