Topic: iostreams oddity?


Author: akv@srl03.cacs.usl.edu (Anil Vijendran)
Date: 1995/04/21
Raw View
I've found that to be pretty harmless... you can't write/put into an
istream object anyway.
--
Anil

___________________________________________________________________________
Anil K Vijendran                    USL Box 43007, Lafayette, LA 70504-3007
akv@cacs.usl.edu                                         (318) 232-5502 [H]





Author: beh@tequila.oche.de (Benedikt Erik Heinen)
Date: 1995/04/19
Raw View
 During the last few days I found a "feature(?)" in the iostreams library,
that seems to be a little odd...

 Why can I open an istreams without ios::in being set or ostreams without
ios::out?
 I mean, I just did that by mistake with an ofstream and searched for quite a
while to find out, why there were no actual writes to the newly created file.

 Or, even worse, why can I open an istream with ios::out (and no ios::in)
being set and vice versa?

  Shouldn't the iostreams check whether the given mode flags make any sense,
and maybe even add ios::in if you missed to set this in an istream, or
ios::out if you used an ostream?


  In case someone's interested in that, I am using gcc 2.5.8 under linux (even
though I don't think that this is only a linux/libg++ problem, as Teale's
iostreams book also just states, that ios::in is the default mode parameter
for an istream).


yours,
 Benedikt




--

signoff

Benedikt Eric Heinen     beh@tequila.oche.de