Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Check to see if a file is open
Message
De
09/05/2007 16:19:42
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Divers
Thread ID:
01223969
Message ID:
01223977
Vues:
13
>How do you check to see if a file is open without attempting to open it first?
>
>I looked at FOPEN(cFileName, nAttribute) and wonder if this would do the job, or is there more to this? I have done this a long time ago, I think.

The reason TRY/CATCH as Nadya suggests (or ON ERROR in older versions) is best is that too many things can go wrong when interacting with any resource external to your program, like files on disk. For example:
  • The file may be used by another person.
  • The file may be R/O. This includes files on a CD.
  • You may not have enough privileges for the folder or file.
  • When adding records, disk may be full.

    ... and probably a few more.
    Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
  • Précédent
    Répondre
    Fil
    Voir

    Click here to load this message in the networking platform