1. File extensions
- Posted by Peter Blue <PeterBlue at COMPUSERVE.COM> Aug 13, 1997
- 524 views
Hi all, Someone wanted a function to extract the extension from a path\filename s= o I have posted these functions. = It is possible to have a path\filename like these :- C:\DATABASE.DBS\DATAFILE C:\DATABASE.DBS\INDEX.IDX\DATAFILE.DAT These are quite legal, so we must only search from the end of the sequenc= e NOT from the start, if it is not found within the last three then it ain'= t there. -- Return file extension as a sequence -- global function Extension(sequence e) integer len len =3D length(e) for idx =3D len to len - 3 by -1 do -- Scan fron end if e[idx] =3D '.' then -- until we find a "." return e[idx..len] -- then exit with ".EXT" end if end for return {} -- Else return blank end function -- Return pointer to file extension -- global function ExtensionPtr(sequence e) integer len len =3D length(e) for idx =3D len to len - 3 by -1 do -- Scan from last if e[idx] =3D '.' then -- Found "." = return idx -- exit with index end if end for return 0 -- ext not found end function Have fun guys - Peter
2. File extensions
- Posted by Tony Steward <figjam at nlc.net.au> Feb 13, 2001
- 481 views
Hi all, Ok I am writin a prog using EDB but I want to use my own extensions. The idea is that there is two databases the main file with extension KTM (KeyTrackerMain) and the second file KTH (KeyTrackerHistory). when the user selects "Open" from the menu they will only see the KTM file. The procedure below does this but I can't create the second file with the KTH i always get filename.KTH.KTM procedure OpenChoice_onClick () filenamemain = getOpenFileName( MainWindow, -- parent window "", -- no default name { "KeyTrack File", "*.KTM"} ) if length( filenamemain ) = 0 then return end if filenamehist = filenamemain[1..length(filenamemain)-4] & ".KTH" Come visit me at www.locksdownunder.com