For std::stream
/ ostream
/ istream
/ ...
: What is the difference between using operators <<
and >>
or using write()
and read()
methods ?
I suppose for binary writing/reading you should use write
/read
, but Is there any difference for text/ASCII ?
write
and read
do not understand anything about the data being printed - for them all there is are bytes. <<
and >>
on the other hand understand what you print and can be overloaded only for a given datatype. As a consequence read and write are generally faster - no complex logic happens, we simply print bytes to the stream.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With