www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/05/02/02:51:24

Date: Thu, 2 May 1996 09:38:30 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Thore Herberg <thore AT ts DOT go DOT dlr DOT de>
Cc: djgpp AT delorie DOT com
Subject: Re: reading binary I/O with iostream
In-Reply-To: <Dqnzyr.rn@news.dlr.de>
Message-Id: <Pine.SUN.3.91.960502093234.6400M-100000@is>
Mime-Version: 1.0

On Tue, 30 Apr 1996, Thore Herberg wrote:

> Is there a way to persuade "cin" and "cout" to read and write
> data in binary format (like fwrite and fread) ?

The type of the streams connected to the console is set before `main' is
called.  If you need to switch them to binary, you can use `setmode'
library function.  I don't know if this will work in C++, or whether 
there is a more C++-ish way of doing it.

Note that switching stdin to binary has some side effects for 
signal-handling mechanism (Ctrl-C doesn't casuse SIGINT when you switch 
file handle 0 to binary mode, unless you call `__djgpp_set_ctrl_c').

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019