From: Endlisnis Newsgroups: comp.os.msdos.djgpp Subject: Re: fstream.open?? Date: Tue, 11 Aug 1998 18:27:01 -0300 Organization: NBTel Internet Lines: 26 Message-ID: <35D0B724.CBFBEFC9@unb.ca> References: <35D04D17 DOT 187A AT efd DOT lth DOT se> NNTP-Posting-Host: fctnts12c27.nbnet.nb.ca Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk 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 Try this: fstream File(Filename, ios::app); File.seekp(0,ios::beg); File.write("a",1); File.close(); 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? -- (\/) Endlisnis (\/) s257m AT unb DOT ca Endlisnis AT GeoCities DOT com Endlis AT nbnet DOT nb DOT ca