Topic: Forcing standard streams to be either binary or text


Author: "No Spam Please" <no.spam.please@home.com>
Date: 1999/12/11
Raw View
Is there a way to force a standard input or output stream (cin / cout) to
read its input in binary mode? The old iostreams library could do it (at
least on some Windows compilers), but there doesn't seem to be standard way
to do it with the current library.
_____

Barry L. Wallis, Senior Systems Engineer
Science Applications International Corporation
4161 Campus Point Court
San Diego, CA 92121





[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]






Author: Steve Clamage <stephen.clamage@sun.com>
Date: 1999/12/11
Raw View
No Spam Please wrote:
>
> Is there a way to force a standard input or output stream (cin / cout) to
> read its input in binary mode?

No. They are by definition text streams. You can create a new binary
stream, but there is no standard way to change the mode of an open
stream. By definition, the standard streams are open before any code
in your program can access them.

> The old iostreams library could do it (at
> least on some Windows compilers),

If so, that would have been a local extension. The original iostreams
from AT&T provided no such capability. I don't know of an
implementation on Unix (for example) that allowed it.

--
Steve Clamage, stephen.clamage@sun.com


[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]