Message-Id: <199709220855.SAA00358@rabble.uow.edu.au> Subject: Re: DJGPP 2.01 C++ I/O problem To: cbalciza AT mail DOT dntis DOT ro Date: Mon, 22 Sep 1997 18:55:23 +1000 (EST) Cc: djgpp AT delorie DOT com (DJGPP) In-Reply-To: from "cbalciza@mail.dntis.ro" at "Sep 22, 97 05:31:56 am" From: Brett Porter MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk > - fails if using C++ style in DJGPP > ifstream f("test.txt", ios::nocreate | ios::in | ios::out | ios::binary); First of all, it should be fstream, not ifstream. ifstreams can't write data. Ahh, but I see you had it correct in your code anyway. You should also specify ios::ate, ios::noreplace or ios::nocreate to make sure it is not overwritten (you need this in Borland too, I'm positive). However, this is a bug in GCC I believe (I had the same problem some time back). Random file access does not work in iostreams. I didn't get any answer about fixing it other than getting the source and recompiling GCC. The only option I have found is to use the old C FILE streams (I actually like these better for binary anyway). HTH Brett -- "Give me ambiguity or give me something else" -- Brett Porter bporter AT rabble DOT uow DOT edu DOT au http://www.geocities.com/CollegePark/Union/3596 Humour, Programming, and more.