Hello Darin,
19 Feb 98, Darin McBride of 1:250/102 wrote to Jan Bijsterbosch
[ question about default filestream being textmode type snipped ]
DM> AFAIK, that's still the case. Not a major deal on unix
DM> systems, but seeing as most of us here are on Intel, ...
DM> good thing to point out, Jan. Some implementations use
DM> ios::binary, others use ios::bin. Unfortunately, I don't
DM> know which one made it into the standard...
RS>> TM> ofstream("file1.fil") << name;
DM> This would be:
DM> ofstream("file1.fil", ios::out | ios::binary) << name;
DM> Or, more likely in binary mode,
DM> ofstream("file1.fil", ios::out | ios::binary).write(name,
DM> NAME_LEN);
Yes, I think the last one is the way to go. However it's prudent to create a
derived class from (i/o)fstream to take care of handling various types
reading and writing from and to such binary streams.
There's a nice example in Tom Swans book "Code Secrets". Not that recent, but
still very informative .
Greetings from sunny Amsterdam,
Jan
email:bijster@worldonline.nl
http://home.worldonline.nl/~bijster
--- MBM v3.41e
---------------
* Origin: Snuffelaar bij DosBoss West (2:500/121.5122)
|