 | CARM User's Guide Discontinued |  |
|
|
| memchr| Summary | | | Description | The memchr function scans buf for the character c in the first len bytes of the buffer. | | Return Value | The memchr function returns a pointer to the character c in buf or a null pointer if the character was not found. | | See Also | memccpy, memcmp, memcpy, memmove, memset | | Example |
#include <string.h>
#include <stdio.h> /* for printf */
void tst_memchr (void) {
static char src1 [100] = "Search this string";
void *c;
c = memchr (src1, 'g', sizeof (src1));
if (c == NULL)
printf ("'g' was not found in the buffer\n");
else
printf ("found 'g' in the buffer\n");
}
|
|
|