strstr function


strstr will find a sub-string within a string. See also strchr which will look for a character in a string.

Library:   string.h

Prototype: char * strstr(const char *s1, const char *s2);

Syntax:	   char string1[]="red dwarf";
	   char string2[]="dwarf";
	   void *pointer;
           pointer = strstr(string1, string2);
strstr returns a pointer to the beginning of the sub-string or NULL if not found.

Example:

example program.

See Also:

strstr man page.

strchr Find a character in a string.


Top Master Index Keywords Functions


Martin Leslie