General information
Category:
Coding, syntax & commands
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
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only