>>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
That should be :
fh = fopen( "cust.dbf" )
if ( fh # -1 )
=fclose( fh )
use cust.dbf
else
wait window "File In Use"
endif
I keep forgetting that greater than/less thans get treated as HTML
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement