]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man3/memchr.3
Wrapped long lines, wrapped at sentence boundaries; stripped trailing
[thirdparty/man-pages.git] / man3 / memchr.3
1 .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
2 .\"
3 .\" Permission is granted to make and distribute verbatim copies of this
4 .\" manual provided the copyright notice and this permission notice are
5 .\" preserved on all copies.
6 .\"
7 .\" Permission is granted to copy and distribute modified versions of this
8 .\" manual under the conditions for verbatim copying, provided that the
9 .\" entire resulting derived work is distributed under the terms of a
10 .\" permission notice identical to this one.
11 .\"
12 .\" Since the Linux kernel and libraries are constantly changing, this
13 .\" manual page may be incorrect or out-of-date. The author(s) assume no
14 .\" responsibility for errors or omissions, or for damages resulting from
15 .\" the use of the information contained herein. The author(s) may not
16 .\" have taken the same level of care in the production of this manual,
17 .\" which is licensed free of charge, as they might when working
18 .\" professionally.
19 .\"
20 .\" Formatted or processed versions of this manual, if unaccompanied by
21 .\" the source, must acknowledge the copyright and authors of this work.
22 .\"
23 .\" Modified Mon Apr 12 12:49:57 1993, David Metcalfe
24 .\" Modified Sat Jul 24 18:56:22 1993, Rik Faith (faith@cs.unc.edu)
25 .\" Modified Wed Feb 20 21:09:36 2002, Ian Redfern (redferni@logica.com)
26 .\"
27 .TH MEMCHR 3 2003-11-01 "" "Linux Programmer's Manual"
28 .SH NAME
29 memchr, memrchr \- scan memory for a character
30 .SH SYNOPSIS
31 .nf
32 .B #include <string.h>
33 .sp
34 .BI "void *memchr(const void *" s ", int " c ", size_t " n );
35 .sp
36 .BI "void *memrchr(const void *" s ", int " c ", size_t " n );
37 .fi
38 .SH DESCRIPTION
39 The
40 .BR memchr ()
41 function scans the first \fIn\fP bytes of the memory
42 area pointed to by \fIs\fP for the character \fIc\fP. The first byte to
43 match \fIc\fP (interpreted as an unsigned character) stops the operation.
44 .PP
45 The
46 .BR memrchr ()
47 function is like the
48 .BR memchr ()
49 function,
50 except that it searches backwards from the end of the \fIn\fP bytes
51 pointed to by \fIs\fP instead of forwards from the front.
52 .SH "RETURN VALUE"
53 The \fBmemchr\fP() and \fBmemrchr\fP() functions return a pointer
54 to the matching byte or NULL if the character does not occur in
55 the given memory area.
56 .SH "CONFORMING TO"
57 The
58 .BR memchr ()
59 function conforms to SVr4, 4.3BSD, C89, C99, POSIX.1-2001.
60 The
61 .BR memrchr ()
62 function is a GNU extension, available since glibc 2.1.91.
63 .SH "SEE ALSO"
64 .BR index (3),
65 .BR rindex (3),
66 .BR strchr (3),
67 .BR strpbrk (3),
68 .BR strrchr (3),
69 .BR strsep (3),
70 .BR strspn (3),
71 .BR strstr (3),
72 .BR wmemchr (3)