🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c++
Article #1548

Re: My .02 on the iostreams

#1548
From: Steve Clamage
Date: Wed, 02 Aug 1995 20:01
21 lines
1436 bytes
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
Technical Details
Message-ID: <3volis$ng4@engnews2.Eng.Sun.COM>
Path: arc1-ca.pugleaf.net!engnews2.Eng.Sun.COM!usenet
References: <jordanz-0208951131510001@204.147.232.52>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!engnews2.Eng.Sun.COM!usenet
From: clamage@Eng.Sun.COM (Steve Clamage)
Newsgroups: comp.std.c++
Subject: Re: My .02 on the iostreams
Date: 2 Aug 1995 20:01:32 GMT
Organization: Sun Microsystems Inc.
Message-ID: <3volis$ng4@engnews2.Eng.Sun.COM>
References: <jordanz-0208951131510001@204.147.232.52>
Reply-To: clamage@Eng.Sun.COM
NNTP-Posting-Host: taumet.eng.sun.com