I have an istringstream object with string of format
STRING,INT,INT,INT
eg.
“name,20,30,40”
I want to read the values into variables of specific types such as std:string and int.
How can I do that?
I have an istringstream object with string of format STRING,INT,INT,INT eg. name,20,30,40 I want
Share
The lazy way:
It is “lazy” because it does not handle format errors in any sensible way.
The smarter ways would be split on commas into a vector of strings (which can then be converted into integers as needed), or use a full-fledged parser, such as boost.spirit.