I'm trying to use ostringstream to concatenate a string in a loop. Unfortunately, only the most recent stream is used. Can anyone point me in the right direction on accomplishing this or similar (other the + with string concatenation)?
Thanks
std:ostringstream os;
for (int i = stk.pop(); i != 0; i = stk.pop()) {
os << i << endl;
}
cout os.str();
So the value of 'os' is overwritten every time? Is there a way to append to the stream?
SOLUTION This code works, I had a bug.
Thanks