Could someone explain me what differences there are between strtok()
and strsep()
?
What are the advantages and disadvantages of them?
And why would I pick one over the other one.
From The GNU C Library manual - Finding Tokens in a String:
One difference between
strsep
andstrtok_r
is that if the input string contains more than one character from delimiter in a rowstrsep
returns an empty string for each pair of characters from delimiter. This means that a program normally should test forstrsep
returning an empty string before processing it.