Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to tell if file is open exclusively ?
Message
From
06/05/2001 07:50:49
 
 
To
05/05/2001 20:41:42
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00503929
Message ID:
00503985
Views:
31
Hello,

To determine if a file is open exclusively by another process try the following:

lnHandle = fopen(otherfile,2) && Read Write
llExcl = lnHandle > 0
if llExcl
= fclose( lnHandle )
endif


Glenn



>Hi!
>
>Use the function ISEXCLUSIVE() it returns true (.T.) if a table or database is opened for exclusive use; otherwise, returns false (.F.).
>
>ISEXCLUSIVE([cTableAlias | nWorkArea | cDatabaseName [, nType]])
>Return Value Logical
>
>nType
>Specifies whether the exclusive status is returned for a table or a database. The following table lists the values for nType and the corresponding status returned. nType Exclusive Status Returned
>1 Table
>2 Database
>
>To determine the exclusive status for a database, you must include nType with a value of 2.
>
>Remarks
>ISEXCLUSIVE( ) returns a value for the table open in the currently selected work area if you omit the optional cTableAlias, nWorkArea, or cDatabaseName arguments.
>
>A table is opened for exclusive use by including the EXCLUSIVE keyword in USE, or by setting SET EXCLUSIVE to ON before the table is opened.
>
>A database is opened for exclusive use by including the EXCLUSIVE keyword in OPEN DATABASE.
>
>Hope that helps.
>
>Sarosh
>
>
>>>>I'm writing a routine to open a file exclusively. If I find the file is already open, how can I tell whether it is opened exclusively other than by closing it and trying to opening it exclusively, trapping for error?
>>>>
>>>You may use SYS(2011) function to retrieve lock status:
>>>
>>Yes it helps. Thank you.
>>
>>Alex
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform