delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/08/07/22:46:30

From: Brett Leslie Porter <bporter AT rabble DOT uow DOT edu DOT au>
Message-Id: <199708080246.MAA21229@rabble.uow.edu.au>
Subject: fstream simultaneous reading and writing
To: djgpp AT delorie DOT com (DJGPP)
Date: Fri, 8 Aug 1997 12:46:01 +1000 (EST)
MIME-Version: 1.0

Please help

DJGPP does not like my fstream.

I want to read and write binary with the read and write functions of fstream.

My open has: open( "saledb.dat", ios::in | ios::nocreate | ios::binary );

this means I can't write out though.

So I added ios::out, and it truncates the file on open, so I can't read.

The only way it allows out but doesn't truncate is to use | ios:app, but
then when I write it ALWAYS goes to the end of the file, no matter where I
seekp to.

I tried ios::ate instead of app but then it trunc's the file again. I also
tried & ~ios::trunc to stop trunc but it still trunc's it.

What is going on here ?

I realise that when I submit the assignment later on Unix I will have to
remove ios::binary

Thanks

Brett Porter

- Raw text -


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