memmem — find a byte subsequence in a byte sequence
[CX] #include <string.h>
void *memmem(const void *haystack, size_t haystacklen,
const void *needle, size_t needlelen);
The memmem() function shall locate the first occurrence of byte sequence needle of length needlelen in byte sequence haystack of length haystacklen.
Upon successful completion, memmem() shall return a pointer to the the first byte of the located byte sequence in haystack, or a null pointer if the byte sequence is not found.
If needlelen is zero, the function shall return haystack.
If haystacklen is less than needlelen, the function shall return a null pointer.
No errors are defined.
None.
None.
This function is similar to strstr(), except that NUL bytes may be included in either needle or haystack.
None.
XBD <string.h>
First released in Issue 8.
return to top of page