delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/05/03/01:00:25

Xref: news2.mv.net comp.os.msdos.djgpp:3373
From: nate AT millcomm DOT com (nate)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: reading binary I/O with iostream
Date: 1 May 1996 20:14:33 GMT
Organization: Millennium Communications, Inc.
Lines: 32
Message-ID: <4m8gn9$o7b@misery.millcomm.com>
References: <Dqnzyr DOT rn AT news DOT dlr DOT de>
NNTP-Posting-Host: mill2.millcomm.com
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Thore Herberg (thore AT ts DOT go DOT dlr DOT de) wrote:


: Is there a way to persuade "cin" and "cout" to read and write
: data in binary format (like fwrite and fread) ? None of the books on C++ that I have
: skimmed trough so far have ever mentioned I/O handling of data in binary format.

no, binary file I/O has to be handled with an fstream (or optionally, an
ofstream or an ifstream) declared as ios::bin or ios::binary (this is
crucial for MSDOS, not as important for unix, because of the way that
binary and text files are handled under the different operating systems)
..  binary information can then be read and written to the streams using
..read or .write (documentation will have more of the specifies on the
arguments here).  CAUTION..  the ios::binary implementation under DJGPP
does **NOT work properly.  I have discovered a bug while trying to
update binary files (straight reading and writing is okay, but updates
will zorch the file).  I've posted to this group about it, and sent mail
to DJ abotu it.. sofar, with no response.


: Where can I find a *complete* documentation of the standart C++ libraries ? 

There are some nice HTML versions of the GNU libs on cygnus.com  also,
there are a few other places for GNU documentation on the web (Trent
Fisher's pages are a good place to start)

-nate erkkilla (nate AT millcomm DOT com>
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
CGS d--- s: a-- C+++(++++) UH$SL+++ P+ L+++ E--- W++ N+ !o !K w O M-- V-- 
PS+++ PE Y+ PGP+ t- 5-- X R tv-- b+ DI+++ D+ G++ e>++ h+ r++ y+  
------END GEEK CODE BLOCK------                                                

- Raw text -


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