How to clear stringstream?

Posted by Knowing me knowing you on Stack Overflow See other posts from Stack Overflow or by Knowing me knowing you
Published on 2010-05-17T09:59:24Z Indexed on 2010/05/17 10:10 UTC
Read the original article Hit count: 197

Filed under:
stringstream parser;
 short top = 0;
         parser << 5;
         parser >> top;
             parser.str("");//HERE I'M RESETTING parser
         parser << 6; //DOESN'T PUT 6 INTO parser
         short bottom = 0;
         parser >> bottom;

Why doesn't it work?

© Stack Overflow or respective owner

Related posts about c++