Thread View: comp.std.c++
3 messages
3 total messages
Started by Jordan Zimmerman
Wed, 02 Aug 1995 18:31
My .02 on the iostreams
Author: Jordan Zimmerman
Date: Wed, 02 Aug 1995 18:31
Date: Wed, 02 Aug 1995 18:31
13 lines
919 bytes
919 bytes
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!
Re: My .02 on the iostreams
Author: Steve Clamage
Date: Wed, 02 Aug 1995 20:01
Date: Wed, 02 Aug 1995 20:01
21 lines
1436 bytes
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
Re: My .02 on the iostreams
Author: Nicholas Scott
Date: Thu, 03 Aug 1995 02:32
Date: Thu, 03 Aug 1995 02:32
33 lines
1594 bytes
1594 bytes
jordanz@altura.com (Jordan Zimmerman) wrote: >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 It is a simple matter to build the class you want. There are a lot of things that iostreams do not do out of the box... no matter... they are designed for extension... 1. Substitute your own source and sink. 2. Introduce new types for insertion and extraction. 3. Write your own formatting primitives (manipulators) There are at least two books on iostreams available in bookstores. Have fun. I did. >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! --- "Once upon a time, ya dressed so fine, threw the bums a dime, in your prime. Didn't you" Shabtai Zissel ben Avraham
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads