Jump to content
  • Advertisement
Sign in to follow this  
Rip7

from iostream to string

This topic is 4851 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I use commonc++ as my socket library and I get an iostream to communicate with the socket. Now I want to read the data send to me using the iostream functions but I want to convert all the data directly to a string first. So what's the best methode to do this, can I stream to ostringstream or something? Changing the buffer isn't possible either (difference between streambuf<->stringbuf). Or is the only solution to read one char at a time and copy it to a string ?

Share this post


Link to post
Share on other sites
Advertisement
Thanks for your answer, this is indeed a good solution. I forgot to look at the string class functions and only searched in the iostream classes.( link)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!