I specifically need to convert an ostream into a string. To be more precise, I have a function:
ostream& f(ostream& out);
(This function is mainly used for a polymorphic overcharge of the << operator) In this case, I need to get what is in the ostream into the string. After some research, I tried this:
stringstream test;
ofstream tmp;
test << f(tmp);
string foo(test.str());
But the string only contains 0s. Does anyone have a solution for this ?
Thank you