|
-
April 26th, 2004, 05:30 PM
#1
How to clear out a stringstream
Hello,
I thought the following code would work, but alas I am stumped. I find little docs on this on the net, and was hoping a member here had a solution other than 'ungetting' all characters gotten.
Code:
stringstream a;
for( int i = 0 ; i < 10 ; i++ ){
a.flush();
a.clear();
a << i ;
cout << a.str();
}
Flush or Clear do not seem to do anything, the idea is to clear it to receive a new slate for the upcoming elements. The code above is simplistic, but I hope I am making sense.
Thanks.
Alex
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|