Topic: My .02 on the iostreams
Author: jordanz@altura.com (Jordan Zimmerman)
Date: 1995/08/02 Raw View
I realize it's much too late for this, but I need to get it off my chest...
It's annoying that the input/output operators (<< >>) are only available
for formatted input/output (i.e. the number 1234 turns into the text
representation "1234"). For my work, I almost never need to do this.
What I need is to input/output in binary representation. It seems my only
option is to sub class the various istream/ostream classes (or use the
read/write members).
--
Jordan Zimmerman, Altura Software
home page: http://www.altura.com/jordanz/home.html
Coming to you fast as lightning on a 9500/120!
Author: clamage@Eng.Sun.COM (Steve Clamage)
Date: 1995/08/02 Raw View
In article 0208951131510001@204.147.232.52, jordanz@altura.com (Jordan Zimmerman) writes:
>I realize it's much too late for this, but I need to get it off my chest...
>
>It's annoying that the input/output operators (<< >>) are only available
>for formatted input/output (i.e. the number 1234 turns into the text
>representation "1234"). For my work, I almost never need to do this.
>What I need is to input/output in binary representation. It seems my only
>option is to sub class the various istream/ostream classes (or use the
>read/write members).
BY DEFINITION, the extractors (>>) and inserters (<<) do formatted text I/O,
and the read/write functions do plain binary I/O.
Subclassing so as to change the definition of the inserters and extractors
would violate this convention and would serve to confuse anyone who
reads your code. You don't have to like the convention, but using
conventional operators to do unconventional things is usually a bad idea
in the long run.
---
Steve Clamage, stephen.clamage@eng.sun.com