Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Is file REALLY there
Message
De
19/08/2009 18:56:46
 
 
À
19/08/2009 18:41:53
Joel Hokanson
Services Integration Group
Bellaire, Texas, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2003
Network:
Windows 2003 Server
Database:
Visual FoxPro
Application:
Web
Divers
Thread ID:
01419112
Message ID:
01419117
Vues:
88
>How do I know if a file is complete with being written to the disk?
>
>I have a program and it uses IF File(XYZ)
>And if that file is there my program will use that file.
>
>On LARGE files the IF FILE() will return .T. even though the other program is still writing that file.
>
>So I get an error.
>
>I did work around by putting a Inkey(5) to delay using the file after it appears, that worked fine.
>However I do not want to wait X seconds every time and what if it was a very large file and x seconds was not enough??

You could use a DO WHILE .T. -loop with TRY/CATCH or ON ERROR [errorfunction] around the code that tries to open the file. As long as the file doesn't really exist on the disk VFP will throw a "file does not exist" error which you can catch and not let the program exit the loop until the file is successfully opened. Add error handling for other errors, as well as a case for exiting the loop after, say, 10 seconds, if the file never appears.

Cheers,
Pertti Karjalainen
Product Manager
Northern Lights Software
Fairfax, CA USA
www.northernlightssoftware.com
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform