One of the possibilities is:
somestringstream.str("");
But is it most optimal? Is there any way to preserve stringstream internal buffer, so that following operator<<() calls would not require to reserve memory again?
See Question&Answers more detail:os