Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
? IsFlocked() behavior
Message
De
21/06/2001 12:48:33
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
21/06/2001 12:19:44
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00521938
Message ID:
00522007
Vues:
10
>Thanks for the info, but...
>
>When I try FOPEN() it returns -1 regardless of the lock state of the table. How would I determine locked vs unlocked with this function?
>
>Sorry to be so ignorant on this.

Richard,
You get .t. from IsFlocked() only if you and current session locked the table.
fopen() returning -1 means that you couldn't open it. Possible cause is already locked somewhere else, session or user. You should also check ferror() if the cause wasn't something else like 'file doesn't exist'
function NotLockedByElse
lparameters tcFile
handle=fopen(tcFile)
if handle>0
 * Not locked somewhere
 fclose(handle)
 return .f.
else
 return ferror()=5
endif
Also you could use
if flock() && Attempt lock if not locked
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform