` Printed Icetips Article

Icetips Article



ABC: Making sure a file is actually closed (C4)
1998-09-08 -- Jim Katz
 
Newsgroups: topspeed.products.c4

> There are a few things here that are problematic.  When you close the
> bank file the filemanger loses track of the file open state, and
> therefor it's not open when you call Access:Bank.Open() as it thinks
> the file is already open, so why open it again?  You CAN use
> Access:Bank.Close() but as you found out, it may or may not close the
> file.  There was a thread about how to unconditionally close a file
> and still keep track of the open state of the file a few months back -
> maybe you should have a look in one of the knowledgebases and see if
> we archived any of it (I certainly hope so)

Here is some code I posted a while back:

  Loop
    Open(ConType,ReadWrite)
    IF Errorcode() = 52  ! File Already Open
      Relate:ConType.Close
    Else
      Close(Contype)
      Break
    End
  End

This just insures that the _actual_ closed state is in sync with what
the filemanager _thinks_ the closed state is.



Printed May 3, 2024, 7:47 am
This article has been viewed/printed 35116 times.
Google search has resulted in 5 hits on this article since January 25, 2004.