parsing strings strtok() and delimiters
Posted on 2004-10-22
Alright, I'm trying to read in an input file that has 6 parts:
Media type, number, genre, title, artist, composer
cd,1,New Age,Glassworks,Philip Glass,Philip Glass
The problem is that sometimes the title, artist, and composer have commas inside
the name. In this case the data line looks like:
cd,78,Classic,\Capriccio Italien,+++\,Eduardo Mata/Dallas,Tchaikovsky
so the comma cannot be used as a delimiter... How can I put an "if" statement on the
delimiter to say "if a backslash is read in, then the next delimiter will be a backslash"
"else, the next delimiter will be a comma."
I can do this without using strtok(token, delimiter), but with the strtok I have no idea.
Please help. Thanks!