SW006014 Microchip Technology, SW006014 Datasheet - Page 139

C COMPILER MPLAB FOR PIC24 MCU

SW006014

Manufacturer Part Number
SW006014
Description
C COMPILER MPLAB FOR PIC24 MCU
Manufacturer
Microchip Technology
Type
MPLAB® C Compilerr
Series
PIC24r
Datasheet

Specifications of SW006014

Supported Families
PIC24
Core Architecture
PIC
Kit Contents
Software And Docs
Mcu Supported Families
PIC24
Tool Function
Compiler
Tool Type
Compiler
Processor Series
PIC24
Lead Free Status / RoHS Status
Not applicable / Not applicable
For Use With/related Products
PIC24
Lead Free Status / Rohs Status
Lead free / RoHS Compliant
© 2008 Microchip Technology Inc.
strstr (Continued)
strtok
Description:
Include:
Prototype:
Arguments:
Return Value:
Remarks:
if (ptr != NULL)
}
Output:
str1 : What time is it?
str2 : is
str3 : xyz
"is" found at position 11
"xyz" not found
Break a string into substrings, or tokens, by inserting null characters in
place of specified delimiters.
<string.h>
char *strtok(char *s1, const char *s2);
s1
s2
iters)
Returns a pointer to the first character of a token (the first character in
s1 that does not appear in the set of characters of s2). If no token is
found, the null pointer is returned.
A sequence of calls to this function can be used to split up a string into
substrings (or tokens) by replacing specified characters with null char-
acters. The first time this function is invoked on a particular string, that
string should be passed in s1. After the first time, this function can con-
tinue parsing the string from the last delimiter by invoking it with a null
value passed in s1.
It skips all leading characters that appear in the string s2 (delimiters),
then skips all characters not appearing in s2 (this segment of charac-
ters is the token), and then overwrites the next character with a null
character, terminating the current token. The function strtok then
saves a pointer to the character that follows, from which the next
search will start. If strtok finds the end of the string before it finds a
delimiter, the current token extends to the end of the string pointed to
by s1. If this is the first call to strtok, it does not modify the string (no
null characters are written to s1). The set of characters that is passed
in s2 need not be the same for each call to strtok.
If strtok is called with a non-null parameter for s1 after the initial call,
the string becomes the new string to search. The old string previously
searched will be lost.
printf("\n");
ptr = strstr(str1, str3);
{
}
else
res = ptr - str1 + 1;
printf("\"%s\" found at position %d\n",
printf("\"%s\" not found\n", str3);
str3, res);
pointer to the null terminated string to be searched
pointer to characters to be searched for (used as delim-
DS51456E-page 135

Related parts for SW006014