Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
'CD' Command
Message
From
17/05/2001 12:13:08
David Fluker
NGIT - Centers For Disease Control
Decatur, Georgia, United States
 
 
To
17/05/2001 11:57:25
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Miscellaneous
Thread ID:
00508322
Message ID:
00508373
Views:
22
>>>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.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform