strtok, strtok_r - split string into tokens
#include <string.h> char *strtok(char *s1, const char *s2); char *strtok_r(char *s, const char *sep, char **lasts); may will return a null pointer. If such a byte is found, it is overwritten by a null byte, which terminates the current token. The strtok() function saves a pointer to the following byte, from which the next search for a token will start.
Each subsequent call, with a null pointer as the value of the first argument, starts searching from the saved pointer and behaves as described above.
The implementation will behave as if no function defined in this document calls strtok().
The strtok() interface need not be reentrant.
The function strtok_r() function strtok_r() returns a pointer to the first character of the first token, writes a null character into s immediately following the returned token, and updates the pointer to which lasts points.
In subsequent calls, s is a NULL pointer and lasts will be unchanged from the previous call so that subsequent calls will move through the string s, returning successive tokens until no tokens remain. The separator string sep may be different from call to call. When no token remains in s, a NULL pointer is returned.
Upon successful completion, strtok() returns a pointer to the first byte of a token. Otherwise, if there is no token, strtok() returns a null pointer.
The function strtok_r() returns a pointer to the token found, or a NULL pointer when no token is found.
No errors are defined.
None.
None.
None.
<string.h>.
strtok() derived from Issue 1 of the SVID.
strtok_r() derived from the POSIX Threads Extension (1003.1c-1995).