strstr, _fstrstr

find one string inside another

Synopsis:

#include <string.h>
char *strstr( const char *str,
              const char *substr );
char __far *_fstrstr( const char __far *str,
                      const char __far *substr );

Description:

The strstr() and _fstrstr() functions locate the first occurrence in the string pointed to by str of the sequence of characters (excluding the terminating null character) in the string pointed to by substr.

The _fstrstr() function is a data-model-independent form of the strstr() function. It accepts far pointer arguments, and returns a far pointer. It is most useful in mixed memory model applications.

Returns:

a pointer to the located string, or NULL if the string is not found

See also:

strcspn()

Examples:

#include <stdio.h>
#include <string.h>

void main()
  {
    printf( "%s\n", strstr("This is an example", "is") );
  }

produces the output:

is is an example

Classification:

strstr() is ANSI; _fstrstr() is WATCOM.

Systems:

strstr()
All (except DOS/PM)
_fstrstr()
All (except Netware, DOS/PM)