Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to tell if file is open exclusively ?
Message
De
15/05/2001 19:47:58
 
 
À
15/05/2001 09:52:38
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00503929
Message ID:
00507631
Vues:
18
Hi Craig

>This does not reliably work. The only reliable way to tell if a file is open exclusively is to try to USE it exclusively and then trap the error.


I have never used the function below to lock tables in VFP but it seemed to work in 2.6 all right. I confess I use it mainly for locking files other than tables. Could you provide a little more detail as to why it would not work. The only issue I can see is that another user could potentially grap the file before the current user gets to use it.

Thanks:)


>>Hello Alejandro
>>
>>This function works with any file not just a dbf.
>>
>>
>>
>>	* Function returns true if file or table can be locked for writing
>>	Func LOCKABLE
>>	Lparam lcFile
>>	Local lcRetval,liHandle
>>	lcRetval=.f.
>>	liHandle=fopen(lcFile,12)
>>	If liHandle>0
>>		lcRetval=.t.
>>		=fclose(liHandle)
>>	Endif
>>	Return lcRetval
>>
>>
>>
>>
>
>
>This does not reliably work. The only reliable way to tell if a file is open exclusively is to try to USE it exclusively and then trap the error.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform