strsep (3) - Linux Man Pages
strsep: extract token from string
strsep - extract token from string
#include <string.h> char *strsep(char **stringp, const char *delim);
Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
is NULL, the
function returns NULL
and does nothing else.
Otherwise, this function finds the first token
in the string
that is delimited by one of the bytes in the string
This token is terminated by overwriting the delimiter
with a null byte ('\0'),
is updated to point past the token.
In case no delimiter was found, the token is taken to be
the entire string
is made NULL.
function returns a pointer to the token,
that is, it returns the original value of
For an explanation of the terms used in this section, see
Interface Attribute Value
Thread safety MT-Safe
function was introduced as a replacement for
since the latter cannot handle empty fields.
conforms to C89/C99 and hence is more portable.
Be cautious when using this function.
If you do use it, note that:
This page is part of release 5.05 of the Linux
A description of the project,
information about reporting bugs,
and the latest version of this page,
can be found at