Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Borland C++ 2.x ( with Turbo C ) - <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   <mem.h>                      Required for declarations only
 #include   <string.h>                   Use either string.h or memory.h

 void       *memchr(buf,ch,cnt);
 const 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'.  The search
    continues until 'ch' is found or 'cnt' bytes have been searched.

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

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

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

    The following statements find the first occurrence of 'z' in 'buff'.

           #include <mem.h>

           char buff[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