Hey everyone,
i have a working socket connection and want to send a stringstream. But send() does not accept stringstreams.
What would be the best way to send the stringstream?
Thank you!
Bye
crisis
Printable View
Hey everyone,
i have a working socket connection and want to send a stringstream. But send() does not accept stringstreams.
What would be the best way to send the stringstream?
Thank you!
Bye
crisis
Do you want to send the actual string collected in the stringstream? Use ss.str().c_str() to get a const char*, and send that.
thank you very much, CornedBee! :)
i am always not sure when its smart to convert strings to chars because i dont have much experience yet
It's never smart, just sometimes necessary. The most common necessity is when you interact with a C API, like sockets.
And there is no C++ library for Sockets, right? Just to make sure that its correct to use the C socket library in my C++ project...
There are a few socket libraries. My personal favourite is Asio. ACE is also good, but much more of a framework - takes longer to learn.