Can someone explain the subtle difference in:
ofstream f("test.txt")
std::stringstream s;
s<<"";
f << s.rdbuf();
f.good() // filestream is bad!!
ofstream f("test.txt")
std::stringstream s;
s<<"";
f << s.str();
f.good() // is still ok!
I mostly use .rdbuf() to push the stringstream to the file (because its more efficient), but if the stringstream is empty than the filestream gets bad...? Isnt this stupid?
I think I dont quite understand << s.rdbuf()
...