Gary Wessle wrote:
Hi
how can I clear a stringstream?
ss.clear();
or
ss.flush();
Depends what you mean by 'clear'. To clear the state
(error flags, etc.) use ss.clear(). This does not clear
the contents of the stringstream, however. In particular,
if you are trying to read data from a stringstream and
fail because of some leftover characters, clear()ing the
stringstream only clears the error flags, leaving the
leftover characters still in the stringstream.
HTH,
- J.