Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
StrToFile Error Handling?
Message
De
09/04/2002 18:03:01
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00642867
Message ID:
00642932
Vues:
17
Steve,

You need temporarily replace your error handler. It sounds like you will want to put this into a loop if you want it to have it try for a certain period of time.

BTW, this is the same type of logic you should use when you want to open a table exclusively to perform packing or recreate indexes.
lcOldError = on("error")
llError = .f.
on error llError = .t.
lcFile = strtofile("file1.txt")
if !llError
    * you successfully got the file
else
    * there was an error
endif

on error &lcOldError
>My problem is that another process/thread could start to use the file in the milliseconds between the time I see that the file is not in use and when I try to erase it. That's why I'd rather try to erase it until I actually do.
>
>
>>You can use FOPEN() function to check if file is open somewhere else.
lnFH = FOPEN(lcFileName, 12)
>>IF lnFH > 0    && file isn't in use
>>  FCLOSE(lnFH)
>>  .....
>>ELSE
>>ENDIF
Steve Gibson
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform