I'm wondering what the best way to write from an std::stringstream
into a vector<int>
.
Here's an example of what's in the stringstream
:
"31 #00 532 53 803 33 534 23 37"
Here's what I've got:
int buffer = 0;
vector<int> analogueReadings;
stringstream output;
while(output >> buffer)
analogueReadings.push_back(buffer);
However what seems to happen is, it reads the first thing, then it gets to #00
and returns 0
because it's not a number.
Ideally, what I want is, it gets to a #
and then just skips all characters until the next whitespace. Is this possible with flags or something?
Thanks.