| |||
| Home > RealView Debugger Predefined Macros > Alphabetical predefined macro reference > strchr | |||
Locates the first occurrence of a character in a string.
char *strchr (str1, byte_value) char *str1; char byte_value;
where:
str1This is a character pointer to the memory location of the first character byte in a string of characters.
byte_valueThis
is a variable of character type, used to specify the character that
the strchr macro must search for. The terminating NUL character
'\0' is part of the string, so it can be searched
for.
char *Points to the first memory location of the first
occurrence of the character byte_value byte.
If no instance of the character being searched for is found, then a NULL pointer
is returned.
For debugger variables only, a -1 value (0xFFFFFFFF)
is returned, when byte_value does not occur in
the string searched on by strchr.
This example shows how to use strchr in
a macro:
define /R void substr(character)
char character;
{
char *pos;
pos = strchr("This is a string",character);
$printf "position: %s\n",pos$;
}
.