CSV help
Posted: Fri Aug 27, 2004 6:15 pm
I have an ini key, for example: key=1,2,3,4,5,6,7
It's pulled from an ini file, by a plugin, and sometimes varies. Sometimes it's longer, sometimes shorter. In all cases I only need to change values 3 and 4 and preserve the previous states of the other values when I write back to the ini.
- Values 1 through 4 are always numbers.
- Anything from the 5th value on may also contain numbers, letters or spaces.
- Sometimes a value from the 5th onward will also contain a comma or other punctuation.
Basically I need to stop CSV'ing after the 4th variable and set the rest as a single string so it can be written back to the ini unchanged, but I'm at a loss. I was using strtok() but I can't figure out how to stop it after the fourth comma and write the rest to a string.
Anyone have any ideas?
It's pulled from an ini file, by a plugin, and sometimes varies. Sometimes it's longer, sometimes shorter. In all cases I only need to change values 3 and 4 and preserve the previous states of the other values when I write back to the ini.
- Values 1 through 4 are always numbers.
- Anything from the 5th value on may also contain numbers, letters or spaces.
- Sometimes a value from the 5th onward will also contain a comma or other punctuation.
Basically I need to stop CSV'ing after the 4th variable and set the rest as a single string so it can be written back to the ini unchanged, but I'm at a loss. I was using strtok() but I can't figure out how to stop it after the fourth comma and write the rest to a string.
Anyone have any ideas?