Remova algo do StringStream

 stringstream ss;
 ss<<"abc\n";
 ss.seekp(-1, std::ios_base::end);
 ss << '\0';
chfle