Foxpert Software Development & Consulting

Menu

Whitepapers
Downloads
Knowlbits
Guineu

2007-05May-16

SET PATH oddities

Without testing this code in the Command Window, can you say what paths Visual FoxPro searches for each of the following SET PATH statements?

SET PATH TO "111,222",333
SET PATH TO 111;"222,333"
SET PATH TO 111, 222 333

The path statement is a little inconsistent. There are some easy rules to follow, though. Everything following TO is treated as a single string. The only exception is if the string starts with a quotation mark. In this case, SET PATH only reads until it encounters the terminating quotation mark and ignores the remainder of the string. Parsing happens strictly on the two delimiting characters comma and semicolon.

With this in mind here's what directories VFP searches for each variation:

1) The last directory is ignored, since VFP only reads until the terminating quotation mark that follows 222.

.\111
.\222

2) 222 and 333 are parsed separately. You cannot specify a directory that has a comma in the name. Note that the last two directory names each contain one quote which renders the path invalid.

.\111
.\"222
.\333"

3) If you have a path with a blank you should not use quotes. Visual FoxPro keeps spaces in the name. It removes, however, blanks at the beginning and the end.

.\111
.\222 333

Previous KnowlBits

RSS

February 2011 (2)

December 2010 (1)

October 2009 (2)

September 2009 (1)

August 2009 (4)

July 2009 (2)

June 2009 (2)

May 2009 (1)

April 2009 (1)

March 2009 (1)

August 2008 (1)

July 2008 (2)

May 2008 (1)

April 2008 (2)

January 2008 (2)

December 2007 (2)

November 2007 (2)

October 2007 (1)

September 2007 (1)

August 2007 (5)

July 2007 (4)

May 2007 (6)

March 2007 (3)

February 2007 (7)

January 2007 (6)

November 2006 (1)

October 2006 (3)

September 2006 (10)

June 2006 (2)

May 2006 (6)

April 2006 (1)


Impressum Kontakt Contact