On Thu, Oct 04, 2001 at 11:10:56AM -0400, Matthew Luchak wrote:
> Is there a way to verify if a file is in use by another user before
> fopening it?  

As far as I know this is something you have to program in yourself.  If
you are only worried about your programs accessing the file, then it is
a good idea to create a lock file.  Before you access a file called
mydata, check for a file called mydata.lock.  If that exists, then the
file is in use, so wait and check later.  If it does not exist, create a
file called mydata.lock, open mydata, do with it as you please, close
mydata, and delete mydata.lock.  

You also have to be prepared to handle a situation where your program
stops before removing the lock file.  Usually with PHP, it is much
easier to just use a database so all this file locking is dealt with by
the database and not you.
-- 
Jason Stechschulte
[EMAIL PROTECTED]
--
Sorry.  My testing organization is either too small, or too large, depending
on how you look at it.  :-)
             -- Larry Wall in <[EMAIL PROTECTED]>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to