Section: Linux Programmer's Manual (3)
Return to Main Contents
memmem - locate a substring
#define _GNU_SOURCE /* See feature_test_macros(7) */
void *memmem(const void *haystack, size_t haystacklen,
const void *needle, size_t needlelen);
function finds the start of the first occurrence
of the substring
in the memory
function returns a pointer to the beginning of the
substring, or NULL if the substring is not found.
This function is a GNU extension.
This function was broken in Linux libraries up to and including libc 5.0.9;
arguments were interchanged,
and a pointer to the end of the first occurrence of
Both old and new libc's have the bug that if
And glibc 2.0 makes it worse, returning a pointer to the
last byte of
This is fixed in glibc 2.1.
This page is part of release 3.54 of the Linux
A description of the project,
and information about reporting bugs,
can be found at
- RETURN VALUE
- CONFORMING TO
- SEE ALSO
This document was created by
using the manual pages.
Time: 09:52:16 GMT, January 16, 2018