From: Ian Miller Newsgroups: comp.os.msdos.djgpp Subject: Re: Bug in `fstream' class Date: 10 Feb 1997 13:54:02 +0000 Organization: Defence Research Agency Lines: 36 Message-ID: References: NNTP-Posting-Host: 146.80.115.106 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Jerzy DOT Witkowski AT ii DOT uni DOT wroc DOT pl (Jerzy Witkowski) writes: > > A friend of mine found a bug in `fstream' class of the `iostream' > library. The bug makes impossible opening single file for both > reading and writing. It is present in both 2.00 and 2.01 > versions. > > The example program is included below. It produces the following > results: > on Sparc with Solaris 2.4 and gcc 2.7.2: > [klm/k-m] (correct) > on PC with DOS and Borland C++ 3.1: > [mlk/m-k] (also correct, I think :-) > on PC with DOS and DJGPP 2.xx: > [ / ] (not spaces, but (char)(255), also data file corrupted) > > Any suggestions? I have had problems with fstream too. I made them less bad by getting the libstdcx sources and compiling them myself. Evidently, the distributed binary library is not up to date (or wasn't the last time I looked). For the record, my problem was that creating a fstream object with an omode of ios::in|ios::out truncated an existing file to zero length. Once I had regenerated the libstdcx.a library it stopped doing that. I do still have one problem however. The get and put "streamposes" returned by tellg() and tellp() are always the same. I think they should be independent. Any suggestions? ;-) -- Ian Miller, Dorset, UK DJGPP 2.01, Win95 DOS box (LFN undefined, FNCASE=y)