OS/161 Reference Manual


strtok_r - tokenize string reentrantly


Standard C Library (libc, -lc)


#include <string.h>

char *
strtok_r(char *string, const char *separators, char **context);


strtok_r is a reentrant version of strtok. It behaves the same way, except that the internal state is kept using the context parameter rather than being global.

The value passed to the context parameter should be the address of a char * whose value is preserved between successive related calls to strtok_r. The char * need not be initialized before the first call, and its value should not be inspected.

Return Values

strtok_r returns successive components of the passed-in string, and NULL when no more remain.