Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Testing for drive or device can write data
Message
De
11/04/2007 20:02:43
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Divers
Thread ID:
01214781
Message ID:
01214788
Vues:
10
>Is there a way to test that a device is capable of writing data before trying to write to it and get a program error? I have clients who don't know or understand that you can't write to a distribution CD but they select it from the directory and then my program tries to write to it and then displays program errors.

ANY interaction with something outside your program might fail. An interaction with a disk may fail for several reasons: R/O, missing privileges, no disk space, etc.

Therefore, this is a good opportunity to test for errors. In VFP 9, you can use TRY ... CATCH. If you can't write, just inform the user that you can't write.
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