I am using istringstream to put strings separated by commas to own std::strings.
I have done this wich works:
std::string One, Two, Three, Four, Five, Six;
std::string Value = "a,b,c,d,e,f";
istringstream is(Value);
while ( getline(is, One, ',') && getline(is, Two, ',') && getline(is, Three, ',') && getline(is, Four, ',') && getline(is, Five, ',') && is >> Six)
{
//Action;
}
So I am extracting Value that consists of 6 strings separated by ",".
Now if I will take "f" away from Value. This will not work. The std::strings One to Five will not be assigned any strings as it is only 5 elements in the string Value now.
Why does this happening ?
Is this possible to make it work when you dont know how many strings you are trying to exctract from Value. The maximum will be 6 though.