Mail Archives: djgpp/1996/05/17/00:19:45
Dieter Demerre wrote:
>
> A couple of months ago I installed DJGPP for I wanted to compile
> my program with it. Just last weekend I found that not all objects
> behave like they do in BC3.1.
> I hereby include my testprogram (partly) that tries to read from
> a file but also write to it.
>
> I find that whenever I open the file to write in it, the file is
> renewed, while this is NOT done in Borland C++ nor in
> the C++ compiler we have here on the VAX- and ALPHA-machines.
>
> Did I do anything wrong ?
Yes, you were right. The libraries are buggy. This problem popped
up a few days ago. The solution is to change the following lines in
\djgpp\gnu\libgplus.271\libio\filebuf.cc:
if ((mode & (int)ios::trunc) ||
((!(mode & (int)ios::app)) && (mode & (int)ios::out)))
posix_mode |= O_TRUNC;
to:
if ((mode & (int)ios::trunc) ||
((!(mode & int(ios::app|ios::in))) && (mode & (int)ios::out)))
posix_mode |= O_TRUNC;
and update libgpp.a, libiostr.a, and libstdcx.a.
---
Wang TianXing
- Raw text -