T
Tron Thomas
What does binary mode for an ofstream object do anyway? Despite which
mode the stream uses, operator << writes numeric value as their ASCII
representation.
I read on the Internet that it is possible to change the behavior of
operator << so it will stream numeric values as their actual values
when an ofstream is in binary mode. I did not, however, find any
information on how this can be accomplished. What is involved in
getting this to work?
Given that it might be complicated to change the behavior of operator
<< for binary streams, I would like to be able to determine how an
object should serialize itself to a stream so that numeric values are
written as their actually value for binary streams and as their ASCII
representation for text streams. How can this be done?
mode the stream uses, operator << writes numeric value as their ASCII
representation.
I read on the Internet that it is possible to change the behavior of
operator << so it will stream numeric values as their actual values
when an ofstream is in binary mode. I did not, however, find any
information on how this can be accomplished. What is involved in
getting this to work?
Given that it might be complicated to change the behavior of operator
<< for binary streams, I would like to be able to determine how an
object should serialize itself to a stream so that numeric values are
written as their actually value for binary streams and as their ASCII
representation for text streams. How can this be done?