memchr()                 Find Character in Buffer
 
 #include   <memory.h>                   Required for declarations only
 #include   <string.h>                   Use either string.h or memory.h
 
 char       *memchr(buf,ch,cnt);
 char       *buf;                        Pointer to buffer
 int        ch;                          Character to copy
 unsigned   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 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 buff[100];
         char *bufptr;
 
         main()
         {
             bufptr = memchr(buffr,'z',100);
         }

Seealso:



This page last updated on Fri Nov 30 10:48:32 MSK 2001
Copyright © 1992-2001, Vitaly Filatov, Moscow, Russia
Webmaster