I have a stream object std::stringstream and I want to get whatever it currently has as a std::string. Is that possible? I want it for output to my graphic console.
1 Answer
You can use the stringstream::str() method for that: https://cplusplus.com/reference/sstream/stringstream/str/
1 Comment
Robᵩ
Note that
stringstream::str() returns a copy of the string, not a reference to it. To update or clear stringstream's string, use stringstream::str(string).