Se deve avere alla fine una std::string gli conviene usare un std:stringstream invece di un std:strstream.