memchr [C++ Reference]
Keywords: c,string,memchr
Date: 2008-10-14T15:42:02-0700

[[memchr]]
C++ Reference
Translations of this page?:

- en
- br-pt
- cn
- cz
- de
- es
- fr
- it
- jp
- nl
- pl
- ro
- ru
- sk
- tr
- tw

## memchr

Syntax:

        #include <cstring>
        void *memchr( const void *buffer, int ch, size_t count );

The memchr() function looks for the first occurrence of ch within count characters in the array pointed to by buffer. The return value points to the location of the first occurrence of ch, or NULL if ch isn't found. For example:

         char names[] = "Alan Bob Chris X Dave";
         if( memchr(names,'X',strlen(names)) == NULL )
           printf( "Didn't find an X\n" );
         else
           printf( "Found an X\n" );

Related Topics: memcmp, memcpy, strstr

Edit this page • Old revisions
• • • Login • Index • Recent changes • RSS • cc •