Tony The Lion
Tony The Lion

Reputation: 63200

convert std::string to basic_ostream?

Is there a conversion for the above?

Upvotes: 9

Views: 10717

Answers (2)

Daniel Trebbien
Daniel Trebbien

Reputation: 39208

Convert a std::string to an output stream? Usually it's: convert a string to an input stream that reads characters from the given string:

std::string myString = //...
std::istringstream iss(myString);

See also: http://www.cplusplus.com/reference/iostream/istringstream/

Upvotes: 18

Cogwheel
Cogwheel

Reputation: 23217

std::ostringstream from <sstream>:

http://www.cplusplus.com/reference/iostream/ostringstream/

Upvotes: 6

Related Questions