Sign in to follow this  
Rip7

from iostream to string

Recommended Posts

Rip7    122
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
Rip7    122
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this