2.1.2.62 strtok


Description

Find the next token in a string.

Syntax

LPSTR strtok( LPCSTR lpszStrToken, LPCSTR lpcszDelimit )

Parameters

lpszStrToken
[input] String containing tokens to be parsed, NULL means get next token from the string that passed in on last times
lpcszDelimit
[input] String containing delimiters

Return

Returns a pointer to the first character of the next token.

Examples

EX1

void strtok_ex1()
{
    char strToken[] = "This,is a.list\tof:tokens";
    char strDelimiter[] = ", .\t:";
    char * ptok;
    ptok = strtok(strToken,strDelimiter); // get first token
    out_str(ptok);
    while(ptok=strtok(NULL,strDelimiter)) // get next token
        out_str(ptok);
}

Remark

Find the next token in a string.

See Also

Header to Include

origin.h

Reference