Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Testing for the ability to use a file exclusive
Message
De
15/01/2000 14:36:22
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00318595
Message ID:
00318607
Vues:
21
>I hope someone can help me.
>I need to initially open a file exclusive, to issue a pack.
>I want the first user in each day to do this. I have a routine which handles the first user in stuff...but my problem is that some users forget to get out.
>
>How can I test to see if a file can be had exclusive....without producing an error if I can't get the file exclusive?
>
>Rick


Rick,
You could try to fopen() file for RW access. It's silent and doesn't produce error. If you cannot get a positive handle number than it's in use.
lnHandle = fopen(myTableName,12)
if lnHandle < 0 && In use
 * ....
else
 =fclose(lnHandle)
 use (myTableName) exclusive
endif
To be more precise and take into account that someone could open it between the few milliseconds (fclose - use) you could set a flag that you're going to get it exclusive to notify other users (ie:write a dummy txt file and check its existence).
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