POV-Ray : Newsgroups : povray.off-topic : C++ questions : Re: C++ questions Server Time
7 Sep 2024 11:21:13 EDT (-0400)
  Re: C++ questions  
From: Mike Raiford
Date: 26 Sep 2008 12:42:16
Message: <48dd10e8@news.povray.org>
Darren New wrote:

> 
> The destructor will close the file when the GC collects the object, but 
> that might be several seconds later. And it might not run if you exit 
> the program before the GC runs, but that's true of C++ also. So it's not 
> quite as nicely deterministic, but it still happens eventually.
> 

C# has the same issue. You can sort of work around it with the using 
statement, which will call Dispose on an IDisposable object, which, in 
turn, closes the file.

-- 
~Mike


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.