On the English version of stackoverflow, I came across this question:
std :: fstream buffering vs manual buffering
Do not really understand what is happening in the write method to the buffer directly? (there is this moment omitted). I understand that you are recording directly via streambuf::sputn (i.e. stream.rdbuf() ->sputn(buffer, length) )? And why is std::ostream::write called at the end, as in the first method? After all, data is already directly written to the buffer.