Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Function To Return Filename From Fullpath?
Message
From
21/11/1997 18:08:00
Christopher Holtz
Integral Computer Services, Inc.
Rochester, New York, United States
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00061582
Message ID:
00061694
Views:
38
>I seem to recall a function that would return the filename if a a string if given the full path of the file. For example if given "C:\APPS\VFP\TEST.DBF" it would return "TEST.DBF". What is that function? Darned if I can recall.


Try This:

LParameter PcFileString && String Containing Path and FileName.
Local LcRetVal && Holds Return Value.
Local LnStringLength && Length of the string containing the file and path
Local LnSlashLocation && Location in PcFileString where the last '\' is.

LnStringLength = Len(PcFileString)
LnSlashLocation = Rat('\',PcFileString)

* Extract the Right-Most characters from the string up to
* the last back slash '\'
LcRetVal = Right(PcFileString, LnStringLength - LnSlashlocation)

Return LcRetVal


- Chris Holtz
Previous
Reply
Map
View

Click here to load this message in the networking platform