SYNOPSIS
       #include 

       char *strsep(char **stringp, const char *delim);
DESCRIPTION
The str function strsep is used to walk through a delim-delimited list of tokens located in stringp. Note that stringp is a pointer to a string pointer - strsep uses stringp to hold its state information - it increments it as it goes along.

Returns a pointer to a string containing the token it just parsed.

NOTES
The man pages has this to say:
       The  strsep() function was introduced as a replacement for
       strtok(), since the latter  cannot  handle  empty  fields.
       (However,  strtok()  conforms  to ANSI-C and hence is more
       portable.)
As for me, I think that the best way to deal with this problem would be to write a little #ifdef'ed macro, which points to strsep when possible, or else a hand-written replacement...

The uses for this function are plural. Write your next language parser with it! Read comma-delimited data!

Log in or register to write something here or to contact authors.