I made a program to test how istringstream works, and I've been having trouble updating the characters in the stream within a for loop.
Here's a code snippet:
Expand|Select|Wrap|Line Numbers
- string some_string="15372";
- int a;
- istringstream buffer(some_string);
- for (int n=0;n<5;n++){
- cout<<n<<endl;
- some_string=some_string+"923";
- buffer.str(some_string);
- buffer>>a;
- cout<<a<<endl<<some_string<<endl;
- }
instead of changing as some_string does.
Essentially, I'm looking for a way to update buffer after some_string changes.