Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Why no Directory() like File()?
Message
 
À
10/12/1999 10:07:43
Michael Dougherty
Progressive Business Publications
Malvern, Pennsylvanie, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00301679
Message ID:
00301826
Vues:
29
>On a similar note, how does one check a table for exclusive access before trying to open it exclusively? (i have a routine which tries exclusive and (if already used) the error trap returns to the next line, which checks if the table is open, and if not, opens shared. I hate it, but it works)

Michael,

I see that tohers have pointed you to the ADIR() function and the Directory command.

As for exclusive use checking, well there is no way to tell if you can open a file exclusively short of opening the file. Even if there was it would be useless as you could check and get told ok and then try to use the fiale exclusively and get told no, because another user opened the file between your check and your USE command. Opening the file exclusively and responding to the possible error is the only way to handle this.

BTW, if your code can use the file shared why are you trying to open it exclusively. Usually we don't open files exclusively unless we are about to do something that requires exclusive use.

Even if you find a way to chaeck the file first, you will still need the error routine in case the situation changes between the check and the USE.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform