www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/02/25/17:15:36

From: Jerzy DOT Witkowski AT ii DOT uni DOT wroc DOT pl (Jerzy Witkowski)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: C++ Iostream lib
Date: 24 Feb 1997 13:05:03 +0100
Organization: University of Wroclaw
Lines: 61
Sender: jwi AT swiatowit DOT ii DOT uni DOT wroc DOT pl
Message-ID: <x6bu9av28g.fsf@swiatowit.ii.uni.wroc.pl>
References: <Pine DOT SUN DOT 3 DOT 91 DOT 970223121248 DOT 1447J-100000 AT is>
NNTP-Posting-Host: swiatowit.ii.uni.wroc.pl
In-reply-to: Eli Zaretskii's message of Sun, 23 Feb 1997 10:14:41 GMT
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

In article <Pine DOT SUN DOT 3 DOT 91 DOT 970223121248 DOT 1447J-100000 AT is> Eli Zaretskii <eliz AT is DOT elta DOT co DOT il> writes:

> On Thu, 20 Feb 1997, Dion Barrier wrote:
> 
> > I'm making the move over to DJGPP and would appreciate some help.  I was 
> > told that the C++ Iostreams library is kind of buggy.
> > More specifically, the bug is supposedly in file I/O.
> 
> The only bugs that I've heard about are in the context of the binary/text 
> files.  You might consider searching the DJGPP mail archives for 
> "iostream".  Point your Web browser to this URL:

Some time ago I've posted information about bug in read/write
streams.  Here is a copy of the original posting.

The bug makes impossible opening single file for both
reading and writing.  It is present in both 2.00 and 2.01
versions.

The example program is included below.  It produces the following
results:
on Sparc with Solaris 2.4 and gcc 2.7.2:
	[klm/k-m] (correct)
on PC with DOS and BC 3.1:
	[mlk/m-k] (also correct, I think :-)
on PC with DOS and DJGPP 2.xx:
	[   /   ] (not spaces, but (char)(255), and data file corrupted)

============================== program begin
#include <fstream.h>
#define FILENAME "fstr.dat"

void fileCreate (void) {
  ofstream f(FILENAME);
  for (char c = 'a'; c != 'z'; c++) f << c;
} // fileCreate

void fileReadWrite (void) {
  fstream f(FILENAME,ios::in|ios::out);
  f.seekg(10); 
  cout << '[' << (char)(f.get()) << (char)(f.get()) << (char)(f.get());
  f.seekp(11);
  f.put('-');
  f.seekg(10); 
  cout << '/' << (char)(f.get()) << (char)(f.get()) << (char)(f.get());
  cout << ']' << endl;
} // fileReadWrite

int main (void) {
  fileCreate();
  fileReadWrite();
  return 0;
} // main
============================== program end
-- 
Jerzy Witkowski     <Jerzy DOT Witkowski AT ii DOT uni DOT wroc DOT pl>          o       o

University of Wroclaw, Institute of Computer Science         /| |   |/|
Przesmyckiego 20, PL-51151 Wroclaw                            |/|   | |
room: 11, phone: 0048 71 3247360                             /| |/^\| |
phone/fax office secretary: 0048 71 3251271                <__|

- Raw text -


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