Date: Wed, 12 Aug 1998 09:55:00 +0200 (WET) From: Andris Pavenis To: Endlisnis cc: djgpp AT delorie DOT com Subject: Re: fstream.open?? In-Reply-To: <35D0B724.CBFBEFC9@unb.ca> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk 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? >