Skip to content

Latest commit

 

History

History
32 lines (22 loc) · 733 Bytes

File metadata and controls

32 lines (22 loc) · 733 Bytes

Home

Extracting the name and extension parts of a path string

Code:

DECLARE SHORT GetFileTitle IN Comdlg32;
	STRING   lpszFile,;
	STRING @ lpszTitle,;
	INTEGER  cbBuf

lpszFile = "c:\Program Files\NetLab\AddressBook.dat"
lpszTitle = SPACE(250)

* for this path the return is "addressbook.dat"

IF GetFileTitle (lpszFile, @lpszTitle, Len(lpszTitle)) = 0
	lpszTitle = LEFT (lpszTitle, AT(Chr(0),lpszTitle)-1)
	? lpszTitle
ENDIF  

Listed functions:

GetFileTitle

Comment:

The path string should be valid Win32 name. Although that does not mean that the file should exist.