Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to tell if a text file is open by another process.
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00220819
Message ID:
00221035
Vues:
57
>>we pull text files into tables for processing nightly. The text files are downloaded by FTP from various machines. We need to be able to tell when the text files are closed by this process, because our processing can't work on these files until they are completely downloaded.
>>
>>any ideas?
>
>It's pretty trivial, actually; simply try opening the file using low-level file I/O for R/W access using FOPEN(); if it fails, something else is using it, or you don't have the necessary permissions to access it:
>
>
FUNCTION CanIUseFile
>LPARAMETER tcFileName
>IF TYPE('tcFileName') # 'C' OR ! FILE(tcFileName)
>   RETURN .F.
>ENDIF
>LOCAL nFH
>nFH=FOPEN(tcFileName,2)
>IF nFH # -1
>   =FCLOSE(nFH)
>   RETURN .T.
>ELSE
>   RETURN .F.
>ENDIF
thanks to all -- current job has managed to flush all knowledge from what was left of my brain. i'll try these and let you know what happens...
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform