strchr [ HP C/iX Library Reference Manual ] MPE/iX 5.0 Documentation
HP C/iX Library Reference Manual
strchr
Locates the first occurrence of a specified character within a string.
Syntax
#include <string.h.>
char *strchr(const char *s, int c);
Parameters
s A pointer to a null-terminated character string.
c The value to find in the target string.
Return Values
x A character pointer to the first occurrence of c in string
s.
NULL The character is not found.
Description
The strchr function searches the null-terminated string s for the first
occurrence of c converted to type char.) The terminating null character
is part of the string.
Example
The following example replaces all occurrences of @ in the array string
with #:
char *ptr, *strchr(), string[100];
:
while((ptr = strchr(string, '@') != NULL)
*ptr = '#';
See Also
strrchr(), strpbrk(), ANSI C 4.11.5.2, POSIX.1 8.1
MPE/iX 5.0 Documentation