...FILL

AddBS(), DefaultExt(), ForceExt(), ForcePath(), JustDrive(), JustExt(), JustFName(), JustPath(), JustStem()

These functions seem much older than their addition to the language in VFP 6 because they've existed in FoxTools.FLL (and DOS's FPATH.PLB) for a long time. Now they've been integrated into the native language, reducing the need for FoxTools to be loaded. See the FoxTools section, in the File Functions subsection, for details on calling each of the functions.

If you're still working with an older version of FoxPro, you won't miss much by not having these functions. You can load FoxTools, or, if you have access to FoxPro 2.x, you can find many of these functions in code in the GenMenu and GenScrn programs. None of these functions is rocket science; most could be rewritten in an IIF() statement or two.

A word of caution: Since most modern operating systems support long file names, including periods within the file name, you'll want to be careful using these functions. They assume that any characters after the first period are part of the file extension.

Example

? ADDBS("fred")                        && Returns "fred\" ? DEFAULTEXT("c:\test","txt")          && "c:\test.txt" ? DEFAULTEXT("c:\test.doc","txt")      && "c:\test.doc" ? DEFAULTEXT("c:\test.document","txt") && "c:\test.document" ? FORCEEXT("c:\test.document","txt")   && "c:\test.txt" ? FORCEPATH("c:\test.document","c:\temp")  * returns "C:\Temp\test.document" ? FORCEPATH("c:\test.document","xxx")  && "xxx\test.document ? JUSTDRIVE("c:\test.document")        && "C:" ? DRIVETYPE(JUSTDRIVE("c:\test.document"))  && 3 (see DRIVETYPE) ? JUSTEXT("c:\test.document")          && "document" ? JUSTFNAME("c:\test.document")        && "test.document" ? JUSTPATH("c:\test.document")         && "c:\" - note slash ? JUSTPATH("c:\temp\test.document")    && "c:\temp" - no slash ? JUSTPATH("c:\Program Files\test.document")   * "c:\Program Files" ? JUSTSTEM("c:\Program Files\test.document")  && "test"

See Also

DriveType(), FoxTools


View Updates

Copyright © 2002 by Tamar E. Granor, Ted Roche, Doug Hennig, and Della Martin. All Rights Reserved.



Hacker's Guide to Visual FoxPro 7. 0
Hackers Guide to Visual FoxPro 7.0
ISBN: 1930919220
EAN: 2147483647
Year: 2001
Pages: 899

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net