On Jan 23, 2007, at 20:34 UTC, Paul Gaspar wrote:

> I have a stream which is always open but needs to be closed  
> regularely to force a physical write of the data to disk (because of 
> the .Flush bug, http://www.realsoftware.com/feedback/viewreport.php? 
> reportid=xltobpqb).

In that case, there is no great advantage of

>     Stream=Nil
>     Stream=F.OpenAsBinaryFile(true)  // Reopen

over

>     Stream.Close
>     Stream=F.OpenAsBinaryFile(true)  // Reopen

However, the first one has the small advantage that if you someday
insert some extra code between the two lines shown, and attempt to make
use of Stream, you'll at least get a NilObjectException rather than a
silent failure.

> Isn't the old stream object destroyed in both cases by  
> F.OpenAsBinaryFile?

Yes, but of course it's not destroyed until AFTER OpenAsBinaryFile
executes, so you have to do some extra step to make sure the stream is
closed first.

Best,
- Joe

--
Joe Strout -- [EMAIL PROTECTED]
Verified Express, LLC     "Making the Internet a Better Place"
http://www.verex.com/

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to