Joe,

what would you recommend in this situation:

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).

The stream is a property in a class or module, not a local variable.

So at the end, what is the advatage of

   Stream=Nil

   Stream=F.OpenAsBinaryFile(true)  // Reopen

over this solution which I use now:

   Stream.Close

   Stream=F.OpenAsBinaryFile(true)  // Reopen

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


Thanks

Paul







Am 23.01.2007 um 17:34 schrieb [EMAIL PROTECTED]:

On Jan 23, 2007, at 09:31 UTC, Carlo Rubini wrote:

Does this approch hold true also for textInputStream  and
binaryStream?

Yes.  I never call .Close on anything in REALbasic; better to let the
framework do it when the object goes out of scope.

Note that if I really need a stream to be closed within a method --
perhaps because I'm about to reopen it with a different object -- I
might do something like this:

  do
    Dim inp As TextInputStream = file.OpenAsTextFile
    ...
  loop until True
  Dim bs As BinaryStream = file.OpenAsBinaryFile( True )
  ...

The do-loop executes only once, since when it gets to the check at the
_______________________________________________
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