I am using the new C++23 std::print
function from the <print>
utility.
My understanding is that the C++ standard does not define whether or not std::print
and std::println
should flush the stream after writing to it.
If I wanted to flush the stream (stdout
or stderr
), what is the most appropriate solution in C++ 23?
Use one of
std::flush
which flushes a std::basic_ostream
or
std::fflush
which operates on a FILE*
.
Detailed references can be found below