Mail Archives: djgpp/1998/08/12/02:58:34
On Tue, 11 Aug 1998, Endlisnis wrote:
> Peter Danielsson wrote:
>
> > I want to change the first byte in a file using fstream. If i use
> > fil.open then fil.write(&ch,1) then fil.close() I get a 1byte large file
> > only including ch. What can I do??
> >
> > /Peter
It's known problem with lgpp272b.zip (more exactly with libstdc++-2.7.2).
This problem is no more with C++ library for gcc-2.8.1. So consider
upgrading gcc and libstdc++.
>
> Try this:
> fstream File(Filename, ios::app);
> File.seekp(0,ios::beg);
> File.write("a",1);
> File.close();
>
This will not help. fstream::fstream erorrously truncates the file.
>
> I think there is a way to open a file so that it starts at 0 but is not
> truncated, but I don't know how. There is a enum for it "ios::trunc" but
> that seems to be the default, I wonder how you can unset that?
>
- Raw text -