delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/08/10/21:30:57

Message-Id: <199708110128.LAA00719@rabble.uow.edu.au>
Subject: DJGPP bug
To: djgpp AT delorie DOT com (DJGPP)
Date: Mon, 11 Aug 1997 11:28:22 +1000 (EST)
From: *** Brett *** <bporter AT rabble DOT uow DOT edu DOT au>
MIME-Version: 1.0

OK... before you irately jump up and down for accusing such a brilliant
compiler of having a bug, let me present my case: hope fully it is my fault
:)

This code works on my Borland compiler as well as the Unix system at uni. (I
think it uses Sun's CC compiler)

The problem line is:
   sDatabaseFile.open( "saledb.dat", ios::in | ios::out | ios::nocreate |
ios::bin );

NB: I took the bin out to compile on Unix.
sDatabaseFile is declared:

static fstream sDataBaseFile;

What happens? In DJGPP this truncates the file. Which bums my whole program
out. So I took the ios::out away, but of course now I can't write to the
file at all. So I put it back and tried ios::ate, but this did nothing to
help - still my file truncates. So I try ios::app instead: now there is no
truncation, but I can't write in the middle of the file. I also tried
specifying ios::in | ios::out & ~ios::trunc | ios::nocreate | ios::bin, but
it still truncated the file. Help!!!!

The docs with DJGPP are very vague when it comes to fstreams. Sorry, not
vague - moreso brief. So I looked up my rather verbose Borland docs and it
says that the default for ios::out is to truncate the file unless ios::app
or ios::ate is specified. So I assume that DJGPP adheres to the same
principle but forgot about doing that for ios::ate?

I would much appreciate help here: we have to use fstreams in our
assignments and I would like to continue using DJGPP, not stupid 16-bit
Borland which is disagreeable with the Unix system we submit to.

Thanks
	Brett

-- 
Brett Porter	
bporter AT rabble DOT uow DOT edu DOT au

http://www.geocities.com/CollegePark/Union/3596 - Humor Page
http://www.geocities.com/SiliconValley/Park/7483 - Programming page
http://rabble.uow.edu.au/people/bporter - Mysterious page - hidden links ;)

- Raw text -


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