memchr

Locates the first occurrence of the specified character in a memory block.

Library:LibC
Classification:ANSI
Service:Characters and Strings

Syntax

  #include <string.h> 
   
  void *memchr (
     const void   *buf,
     int           ch,
     size_t        length);
  

Parameters

buf

(IN) Points to the object to be searched.

ch

(IN) Specifies the character to be located.

length

(IN) Specifies the maximum number of bytes to search.

Return Values

If successful, returns a pointer to the located character. If the character does not occur in the object, returns a NULL pointer.

Remarks

The memchr function locates the first occurrence of ch (converted to an unsigned char) in the first length characters of the object pointed to by buf.

See Also