1MEMCHR(3) Linux Programmer's Manual MEMCHR(3)
2
3
4
6 memchr, memrchr - scan memory for a character
7
9 #include <string.h>
10
11 void *memchr(const void *s, int c, size_t n);
12
13 void *memrchr(const void *s, int c, size_t n);
14
16 The memchr() function scans the first n bytes of the memory area
17 pointed to by s for the character c. The first byte to match c (inter‐
18 preted as an unsigned character) stops the operation.
19
20 The memrchr() function is like the memchr() function, except that it
21 searches backwards from the end of the n bytes pointed to by s instead
22 of forwards from the front.
23
25 The memchr() and memrchr() functions return a pointer to the matching
26 byte or NULL if the character does not occur in the given memory area.
27
29 The memchr() function conforms to SVr4, 4.3BSD, C89, C99, POSIX.1-2001.
30 The memrchr() function is a GNU extension, available since glibc
31 2.1.91.
32
34 index(3), rindex(3), strchr(3), strpbrk(3), strrchr(3), strsep(3), str‐
35 spn(3), strstr(3), wmemchr(3)
36
37
38
39 2003-11-01 MEMCHR(3)