Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
'CD' Command
Message
De
17/05/2001 12:13:08
David Fluker
NGIT - Centers For Disease Control
Decatur, Georgie, États-Unis
 
 
À
17/05/2001 11:57:25
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Divers
Thread ID:
00508322
Message ID:
00508373
Vues:
24
>>>P.S. I did this instead: gcBase = CHR(34) + "C:\Program Files\Gnu\" + Chr(34)
>>
>>Stephane,
>>
>>You can also do CD "&gcPath"
>
>OK, I find this solution to be just plain wierd!
>
>Souldn't VFP try to find a directory called '&gcPath' on my computer (and hence fail because, obviously, there is no such directory on my computer)?
>
>In the end, it's but a STRING. Why is VFP analyzing it's content?
>
>Stephane.

Stephane,

It is because VFP replaces the gcBase macro with C:\Program Files\Gnu\ before sending the line to the interpreter. So while the line looks like CD "gcBase" in the code, the interpreter sees CD "C:\Program Files\Gnu\"

The reason CD (gcPath) works is because the parameter in the CD command is a FoxPro Name Expression. FoxPro tries to use is as is. So CD C:\Windows tries to go to the C:\Windows directory and CD gcBase tries to go to the gcBase directory. Enclosing gcBase in parenthes tells the interpreter to resolve the variable first, so in your case, CD (gcBase) tries to go to the C:\Program Files\Gnu\ directory.

I wrote an article about the differences between Macro Expansion and Name Expressions a few years ago. You can find it in FAQ#7841. It explains all of this in some detail.
David.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform