Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8772229
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T17:59:16+00:00 2026-06-13T17:59:16+00:00

Possible Duplicate: In C++, how do you clear a stringstream variable? I have a

  • 0

Possible Duplicate:
In C++, how do you clear a stringstream variable?

I have a problem with a string i want to use to display in my loop.

I set it up like this in my loop:

//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 }

The problem i have is the output first shows Hello then in the other location it has HelloGoodBye, i need to clear the content before i add Goodbye so i only see that in the second location on screen.

So how would i clear the information of Hello before I change it to Goodbye ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T17:59:17+00:00Added an answer on June 13, 2026 at 5:59 pm

    If you must use a stringstream, call

    s.str("");
    

    to clear it

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: How to clear stringstream? I have this c++ command //siteurl and filename
Possible Duplicate: Function to Clear the Console in R In bash, its like this:
Possible Duplicate: list.clear() vs list = new ArrayList<int>(); I have a list: List<Integer> l1
Possible Duplicate: Can main function call itself in C++? I found this problem very
Possible Duplicate: Explanation of an algorithm to set, clear and test a single bit
Possible Duplicate: Clear 5 empty TDs with Jquery I want to search the DOM
Possible Duplicate: Testing use of NSURLConnection with HTTP response error statuses This is bizarre;
Possible Duplicate: How do you set, clear and toggle a single bit in C?
Possible Duplicate: How to clear/empty Java Stringbuilder I'm adding values to a string and
Possible Duplicate: How to clear browser cache with php? I have created a web

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.