Mail Archives: djgpp/1997/08/11/09:07:57
*** Brett *** <bporter AT rabble DOT uow DOT edu DOT au> wrote:
> 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
> :)
Only an idiot can say that GCC is bug free. Look in my pages I have at least 6
bugs documented (serious ones).
> 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.
Here the fault isn't in the compiler but in the library. I saw it and is too
annoying.
> 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!!!!
Stop trying. Open the file with fopen (or was open?) and pass the file handler
to the constructor (there are a constructor for that).
> 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?
Hmmm standars here .... I don't know.
SET
------------------------------------ 0 --------------------------------
Visit my home page: http://www.geocities.com/SiliconValley/Vista/6552/
Salvador Eduardo Tropea (SET). (Electronics Engineer)
Address: Curapaligue 2124, Caseros, 3 de Febrero
Buenos Aires, (1678), ARGENTINA
TE: +(541) 759 0013
- Raw text -