Sender: crough45 AT amc DOT de Message-Id: <97Nov4.184128gmt+0100.11651@internet01.amc.de> Date: Tue, 4 Nov 1997 17:44:20 +0100 From: Chris Croughton Mime-Version: 1.0 To: eldredge AT ap DOT net Cc: blizzar AT hem1 DOT passagen DOT se, djgpp AT delorie DOT com Subject: Re: Writing to a file from dtor doesn't work! Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Precedence: bulk Nate Eldredge wrote: > *Are* files Supposed to work in destructors? If they don't there's something very wrong with the C++ specification. Think of a database class - you want it to close the database tidily before it disappears. I hadn't noticed this behaviour before because the only files I close in the dtor are in dynamic instantiations of the classes (either deleted explicitly or in inner blocks. I'll see if I can find any mention of it in Stroustrup tonight. Of course, if you use the iostream library then that should behave properly, closing the file only when you delete the stream object. Does this work? Chris C