1. file extensions
- Posted by "Vikas B. Patel" <patelv at EROLS.COM> Aug 12, 1997
- 684 views
Hello, I need a Euphoria routine to get the extension of a file. Any ideas? Thanks, Vikas B. Patel ******************************************************************* \*The Programmers' Guild:For the Amatuer and Hardcore Programmers*/ \\* http://www.geocities.com/SiliconValley/Way/7272/main.html *// \\\*OM http://home.onestop.net/tpg OM*/// \\\\*OM |Maintained by Vikas B. Patel| OM*//// \\\\\*OM Mera Bharat Mahaan OM*///// *******************************************************************
2. Re: file extensions
- Posted by Jacques Deschenes <desja at GLOBETROTTER.QC.CA> Aug 12, 1997
- 678 views
- Last edited Aug 13, 1997
At 12:27 12-08-97 -0400, you wrote: >---------------------- Information from the mail header ----------------------- >Sender: Euphoria Programming for MS-DOS <EUPHORIA at >MIAMIU.ACS.MUOHIO.EDU> >Poster: "Vikas B. Patel" <patelv at EROLS.COM> >Subject: file extensions >------------------------------------------------------------------------------- > >Hello, > I need a Euphoria routine to get the extension of a file. Any ideas? >Thanks, >Vikas B. Patel Here is a function that separate the components of a file name. function SplitPath(sequence path) -- split path to its constituants: directory, name, extension -- return {directory, name, extension} sequence dir, name, ext integer pos, l l = length(path) pos = find('\\',reverse(path)) if pos = 0 then dir = "" name = path else dir = path[1..l-pos+1] name = path[l-pos+2..l] end if pos = find('.',name) if pos then name = name[1..pos-1] ext = name[pos..length(name)] else ext = "" end if return {dir,name,ext} end function -- SplitPath() ----------------------------------- Jacques Deschenes Baie-Comeau, Quebec Canada desja at globetrotter.qc.ca
3. Re: file extensions
- Posted by Robert B Pilkington <bpilkington at JUNO.COM> Aug 12, 1997
- 654 views
>I need a Euphoria routine to get the extension of a file. Any ideas? temp = find('.', filename) if temp != 0 then ext = filename[temp..length(filename)] end if If filename = "THIS.DAT" then ext will be ".DAT".
4. Re: file extensions
- Posted by Larry D Poos <ldpoos at JUNO.COM> Aug 12, 1997
- 676 views
On Tue, 12 Aug 1997 12:27:26 -0400 "Vikas B. Patel" <patelv at EROLS.COM> writes: >Subject: file extensions > I need a Euphoria routine to get the extension of a file. Any >ideas? See "dir" in library.doc and the code in search.ex that comes with Euphoria. I get some of my best code ideas from looking at how others do something and then converting it to do what I want done. As long as I don't use the copyrighted code AFAIK there is no law against examining it and getting ideas for your own code algorithms from it. Larry D. Poos -[USMC (Retar{bks}{bks}ired) Havelock, NC]- - Programming and System Consultant, LTAD Enterprises -