Original Post
I have a stream (file stream, let''s say) that''s sending me text data. The data is formatted as follows:
"1,2,3;text\n"
1, 2 and 3 are variable-length integers. text is variable-length text. The remaining delimiters always appear.
Question: shouldn''t I be able to use STL''s iostreams to parse this? I figured some combination of stringstream and string would allow something like this:
string line = "1,2,3;text\n";
/* magic stringstream stuff */
/* int data[3] now equals { 1, 2, 3 } */
/* string text now equals "text"
One would think the operator >> would come in handy, but I can''t figure out how to make it tokenize anything but whitespace. There has to be something I''m missing; all that iostream stuff and I still don''t have sscanf functionality?!