Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Microsoft C 6.0 - <b>memchr() find character in buffer</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 memchr()                Find Character in Buffer

 #include   <memory.h>                   Required for declarations only
 #include   <string.h>                   Use either string.h or memory.h

 void       *memchr(buf,ch,cnt);
 void       *buf;                        Pointer to buffer
 int        ch;                          Character to copy
 size_t     cnt;                         Number of characters

    memchr() searches 'buf' for the first occurrence of 'ch', continuing
    either until 'ch' is found or until 'cnt' bytes have been searched.

    Returns:    A pointer to the location of 'ch' in 'buf' if 'ch' is
                found.  If the first 'cnt' bytes of 'buf' do not contain
                'ch', NULL is returned.

      Notes:    Buffers are arrays of characters and are usually not
                terminated with a null character ('\0').  The
                buffer-manipulation routines always have a length or
                count argument.

   -------------------------------- Example ---------------------------------

    The following statement finds the first occurrence of 'z' in 'buff'.

           #include <memory.h>

           char buffr[100];
           char *bufptr;

           main()
           {
               bufptr = memchr(buffr,'z',100);
           }


See Also: memccpy() memcmp() memcpy() memset()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson