strstr -- Locate First Occurrence of a String within a String

SYNOPSIS
#include <string.h>
char *strstr(const char *str1, const char *str2);
DESCRIPTION
strstr
scans the input string str1
for the first occurrence of
the search string str2
.
RETURN VALUE
strstr
returns a character pointer to the first occurrence of the
search string in the input string. If the search string cannot be found,
strstr
returns NULL
.
CAUTION
Both arguments must be terminated with the null character; otherwise, a
protection or addressing exception can occur.
EXAMPLE
#include <string.h>
#include <stdio.h>
main()
{
char *text_buffer ="12345-n67-n89";
char *word_break ="-n";
char *hyphen;
hyphen = strstr(text_buffer, word_break);
printf("The first occurence of "-n" is after the digit %cn",
*(hyphen-1));
}
RELATED FUNCTIONS
strchr
, stcpm
SEE ALSO
String Utility Functions