Книга: Programming with POSIX® Threads

6.5.3 String token

6.5.3 String token

char *strtok_r ( char *s, const char *sep, char **lasts);

This function returns the next token in the string s. Unlike strtok, the context (the current pointer within the original string) is maintained in lasts, which is specified by the caller, rather than in a static pointer internal to the function.

In the first call of a series, the argument s gives a pointer to the string. In subsequent calls to return successive tokens of that string, s must be specified as NULL. The value lasts is set by strtok_r to maintain the function's position within the string, and on each subsequent call you must return that same value of lasts. The strtok_r function returns a pointer to the next token, or NULL when there are no more tokens to be found in the original string.

Оглавление книги


Генерация: 1.448. Запросов К БД/Cache: 3 / 0
поделиться
Вверх Вниз