From: "sl" Newsgroups: comp.os.msdos.djgpp Subject: DJGPP 2.01 / GCC 2.8.1 implementation flaw Date: Fri, 20 Nov 1998 23:23:06 -0500 (EST) Organization: Posted via Supernews, http://www.supernews.com - Discussions start here! Lines: 25 Message-ID: NNTP-Posting-Host: 205.205.70.87 Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: 911625392 ZCZSLWF4G4657CDCDC usenet80.supernews.com X-Complaints-To: newsabuse AT supernews DOT com X-Newsreader: PMINews 2.00.1205 For OS/2 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Hello, According to my trusty book here, ofstream defaults to using ios::trunc when opening file.. Meaning all output-files should be truncated by default. My problem is that when I don't trust GCC and use the following statement: ofstream someFile("hello.txt", ios::trunc); Looking at the implementation I found the problem.. The constructor defaults "mode" to "ios::out" .. when I use ios::trunc in place and override the default, the file knows it should open in truncate mode, but it does not know to open in output mode. I believe this is an implementation fault: no matter what the programmer specifies, ofstream should ALWAYS use ios::out and when someone chooses to do ofstream someFile("hello.txt", ios::trunc); like me, it should know that really means ios::out|ios::trunc.. After all, that *is* the definition of the ofstream class. Any suggestions, comments? Gili