<分区>
Possible Duplicate:
In C++, how do you clear a stringstream variable?
我想在循环中显示的字符串有问题。
我在我的循环中是这样设置的:
//while {
std::stringstream s;
s << "Hello";
font_surface = TTF_RenderText_Solid(font,s.str().c_str(),font_color);
apply_surface(x,y,font_surface,screen);
s << "GoodBye";
if(font_surface = TTF_RenderText_Solid(font,s.str().c_str(),font_color);
apply_surface(bx,by,font_surface,screen);
//end loop }
我遇到的问题是输出首先显示 Hello
然后在其他位置它有 HelloGoodBye
,我需要在添加 Goodbye< 之前清除内容
所以我只在屏幕上的第二个位置看到它。
那么如何在将 Hello
更改为 Goodbye
之前清除信息?