Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
FOPEN() to go exclusive
Message
 
 
À
02/08/2003 12:01:16
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00816200
Message ID:
00816206
Vues:
19
Hi Michel,

Basically, this is the same problem as with opening a table exclusively. In that case the only reliable solution is to use Error Handler.

Which VFP version you're using? If VFP8, you should put the whole code in try catch block... There are no other ways...

>I have a situation that I would like to resolve. It happens once after a million processes but I would like to make sure it doesn't happen again. I am using FOPEN() to detect if a specific file exist. If it exists, I FCLOSE() and ERASE it. However, if two users are going into that process at the about same time, it may well be that once one does FCLOSE() that the other one gets its FOPEN() before the first one do the ERASE thus it generates an error on the first one on that command.
>
>Here's the code:
>
>
>lnHandle=FOPEN(gcClientFat+'StyleSheet\'+PADL(gnMember,6,'0')+lcNextItem+'.css',12)
>IF lnHandle>0
>   FCLOSE(lnHandle)
>   ERASE (gcClientFat+'StyleSheet\'+PADL(gnMember,6,'0')+lcNextItem+'.css')
>ENDIF
>
>
>How can I make sure that the exclusive is preserved from the FOPEN() command to the ERASE command? Basically, I need to improve that mechanism to assure no collision happens.
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform