Advertisement Jump to content
Sign in to follow this  
Rip7

from iostream to string

This topic is 4922 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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!