by __david__ · 16y ago · 0 comments
Secondly, this is C code--it's pretty low-level. Yes, strsep() messes with your input. But that is very well documented. If you don't want it to, strdup() beforehand (or strndup() if you don't trust the input).
His whole example of strtok() dying on a character constant is stupid--why on earth would you do that? If you've got a string constant you may as well just have the constant array and save yourself the parsing headache.
This isn't rocket science.
The people who designed the C string functions should have been made to pee in a cup before they were allowed into the building. So much trouble could have been avoided if they had only been consistent about using memory block sizes as parameters rather than "string" (sic) lengths.