Hi! I’m clsung

Hi! I’m clsung

clsung’s blog site, or you can call me AlanSung

Hi! I’m clsung RSS Feed
 
 
 
 

how to clear ostringstream?

下面這程式真有清掉嗎?

ostringstream os;

os.clear();
cerr << os.str()

沒有!得用

os.str("");

才行

Share and Enjoy:
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • funp
  • Haohao
  • Hemidemi
  • Live
  • MisterWong
  • TwitThis
  • udn

2 Responses to “how to clear ostringstream?”

  1. 1
    jeffhung:

    stream 的 clear() 是用來清除 state flags 的。

    See C++98 27.4.4.3.4~5。

  2. 2
    clsung:

    所以說,真是不直覺 :-/

Leave a Reply

噗浪:

分類

Flickr

    clsung. Get yours at bighugelabs.com/flickr

Blogroll

    馬的警總回來了
Creative Commons Attribution-NonCommercial-ShareAlike 2.5 Taiwan
Creative Commons Attribution-NonCommercial-ShareAlike 2.5 Taiwan