Mail Archives: djgpp/1997/09/22/04:56:16
> - 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.
- Raw text -