Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
? IsFlocked() behavior
Message
From
21/06/2001 12:48:33
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00521938
Message ID:
00522007
Views:
9
>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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform