Unless performance of the I/O REALLY matters, use whichever makes your program the clearest (easiest to read).
In the vast number of programs I've written, only a few have needed special treatment to "how fast the I/O is" - and most of the problem with std::stream
functions has to to with the actual parsing of the input [as well as sync with stdio] - which, if you are reading, say, floating point numbers, will be quite difficult to write your own version of [that accepts the full range of formats that std::stream
allows].
If I/O performance REALLY matters, then using std::stream::read
and std::stream::write
may be the solution, but in most cases, best performance comes from using the non-portable mmap
and MapViewOfFile
interfaces that "map" the contents of a file directly from the filesystem to the virtual memory of the application. This saves on the amount of copying the processing of the data takes, and will make it a little faster.