Visit Our UNIX and Linux User Community

Linux and UNIX Man Pages

Test Your Knowledge in Computers #502
Difficulty: Medium
If a function uses a particular process or algorithm such as a Fast Fourier Transform to perform an operation, it would not be appropriate to document it in a series of comments in the source code.
True or False?
Linux & Unix Commands - Search Man Pages

memchr(3) [freebsd man page]

MEMCHR(3)						   BSD Library Functions Manual 						 MEMCHR(3)

memchr -- locate byte in byte string LIBRARY
Standard C Library (libc, -lc) SYNOPSIS
#include <string.h> void * memchr(const void *b, int c, size_t len); void * memrchr(const void *b, int c, size_t len); DESCRIPTION
The memchr() function locates the first occurrence of c (converted to an unsigned char) in string b. The memrchr() function behaves like memchr(), except that it locates the last occurrence of c in string b. RETURN VALUES
The memchr() and memrchr() functions return a pointer to the byte located, or NULL if no such byte exists within len bytes. SEE ALSO
memmem(3), strchr(3), strcspn(3), strpbrk(3), strrchr(3), strsep(3), strspn(3), strstr(3), strtok(3), wmemchr(3) STANDARDS
The memchr() function conforms to ISO/IEC 9899:1990 (``ISO C90''). The memrchr() function is a GNU extension and conforms to no standard. HISTORY
The memrchr() function first appeared in GNU libc 2.1.91, this implementation first appeared in FreeBSD 6.4, coming from OpenBSD 4.3. BSD
April 9, 2008 BSD

Check Out this Related Man Page

MEMCHR(3)						     Linux Programmer's Manual							 MEMCHR(3)

memchr, memrchr, rawmemchr - scan memory for a character SYNOPSIS
#include <string.h> void *memchr(const void *s, int c, size_t n); void *memrchr(const void *s, int c, size_t n); void *rawmemchr(const void *s, int c); Feature Test Macro Requirements for glibc (see feature_test_macros(7)): memrchr(), rawmemchr(): _GNU_SOURCE DESCRIPTION
The memchr() function scans the initial n bytes of the memory area pointed to by s for the first instance of c. Both c and the bytes of the memory area pointed to by s are interpreted as unsigned char. The memrchr() function is like the memchr() function, except that it searches backward from the end of the n bytes pointed to by s instead of forward from the beginning. The rawmemchr() function is similar to memchr(): it assumes (i.e., the programmer knows for certain) that an instance of c lies somewhere in the memory area starting at the location pointed to by s, and so performs an optimized search for c (i.e., no use of a count argument to limit the range of the search). If an instance of c is not found, the results are unpredictable. The following call is a fast means of locating a string's terminating null byte: char *p = rawmemchr(s, ''); RETURN VALUE
The memchr() and memrchr() functions return a pointer to the matching byte or NULL if the character does not occur in the given memory area. The rawmemchr() function returns a pointer to the matching byte, if one is found. If no matching byte is found, the result is unspecified. VERSIONS
rawmemchr() first appeared in glibc in version 2.1. memrchr() first appeared in glibc in version 2.2. CONFORMING TO
The memchr() function conforms to SVr4, 4.3BSD, C89, C99, POSIX.1-2001. The memrchr() function is a GNU extension, available since glibc 2.1.91. The rawmemchr() function is a GNU extension, available since glibc 2.1. SEE ALSO
ffs(3), index(3), rindex(3), strchr(3), strpbrk(3), strrchr(3), strsep(3), strspn(3), strstr(3), wmemchr(3) COLOPHON
This page is part of release 3.44 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at 2012-04-23 MEMCHR(3)

6 More Discussions You Might Find Interesting

1. Programming

C program in Unix / Linux - Time differences

Hi Friends, When Iam running c program in redhat linux 7.3 version and PCQ Linux 8.0 version, its taking around 20 seconds. But when Iam running it in HP-UX Release 11i, its taking around 3 minutes. Can anyone throw light on this. Thanks in advance, Praveen. (11 Replies)
Discussion started by: chprvkmr
11 Replies

2. Solaris

Apache config issue

I want to build a little website on a Sun Blade 100 running Solaris 10. I just went out to and downloaded Unix Source: httpd-2.2.8.tar.gz After unpacking the tarball, I CD'd into the subdirectory and ran the configure utility. Of course, it crapped out. I see that it is... (17 Replies)
Discussion started by: BrewDudeBob
17 Replies

3. Solaris

Need help in building gcc on solaris.

We are moving from old solaris to new version of solaris. I have copied the gcc compiler installed on old server to new solaris server. But just copying didn't work. So I am trying to build it on the new server. The server version is sailfish@st-kvar02 -> uname -a SunOS st-kvar02 5.10... (7 Replies)
Discussion started by: nalina.hv
7 Replies

4. Shell Programming and Scripting

Files with 0 file size and created today

hi, I am building a script to identify those files created/modified today and with file size 0. I am able to find the files with 0 file size and created/modified in last 24 hrs as shown below but not today (current date), I tried using (touch -t time filenm) but in my version of unix at work it... (7 Replies)
Discussion started by: rushs682
7 Replies

5. Programming

Wildcard Pattern Matching In C

I've been having problems lately trying to do pattern matching in C while implementing wildcards. Take for instance the following code: #include <sys/types.h> #include <sys/stat.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <dirent.h> #include <string.h> ... (14 Replies)
Discussion started by: Azrael
14 Replies

6. AIX

Compiling problem - AIX 7.2

Hi We meet errors while running configuration scripts to prepare compiling source code on AIX 7.2. This error does not happen on AIX5.3 and AIX6.1 With the “/usr/bin/sh” from AIX7.2, sometimes , the script runs sucessfully, sometimes not. It’s unstable, and I don’t know why. When... (10 Replies)
Discussion started by: bobochacha29
10 Replies

Featured Tech Videos