Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Checking for Locked Files
Message
De
24/06/1999 11:22:29
Paul Frost
Instem Computer Systems Ltd
Stone, Royaume Uni
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Problèmes
Divers
Thread ID:
00233514
Message ID:
00233525
Vues:
23
>I am running a VFP 6.0 app on a network which is using the same tables I am using. The other app uses the files exclusively. I need to be able to check if the files (cust.dbf) is in use by another computer so my code doesn't bomb out when it goes to to a USE command. I tried ISFLOCKED() but it needs an alias and I can't create the alias without issuing the USE command. HELP!

I use low-level file functions to do the check, these return an error code :

fh = fopen( "cust.dbf" )
if ( fh <> -1 )
fclose( fh )
use cust.dbf
else
wait window "File In Use"
endif

there is the danger that another will grab the file in the small time window between the fclose & the use & there's no guarantee that the -1 return is due to the file already being open - it may not exist for example, but extra code code be put in to test these conditions if required.

If anyone knows a better method, I'd like to know

hth
Paul
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform