I have a file that contains lines like:
2/3/4 5/6/7 8/9/10
and I want to extract the 2, the 5, and the 8
So I am parsing the line by the ' ' delmiter to get
2/3/4
5/6/7
8/9/10
then I need to parse each of those to get the stuff up to the first '/'
indata.open(filename);
string line;
getline(indata, line);
//line is now "hello world yay"
stringstream Parsed(line);
//I can read to ' ' delimiter with >>
string a, b, c;
Parsed >> a; // a == "hello"
Parsed >> b; // b == "world"
Parsed >> c; // c == "yay"
//Now I want to parse a by the '/' character
string d;
getline(a, d, '/');
I get this error
error: no instance of overloaded function "getline" matches the argument list
argument types are: (std::string, std::string, char)
Why does this not work?
Thanks!
Dave