Date: Sat, 02 Aug 1997 11:13:31 -0400 (EDT) From: stunajoh AT ACS DOT EKU DOT EDU Subject: Re: file finding function? In-reply-to: <33E0581D.4CDBD654@ibogfs.df.unibo.it> To: Guido Gonzato Cc: djgpp AT delorie DOT com Message-id: MIME-version: 1.0 Content-type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk On Thu, 31 Jul 1997, Guido Gonzato wrote: > Majisun wrote: > > > > Is there a function that will find out if there is any file with a certain > > extension in the current directory, and then return the filename? > > > > -Sthel Majisun > > > yeah. It's the "file" utility, which can do *much* more than simply look > for files by extension. Look in the v2gnu/ dir of your simtelnet mirror. > Maybe this is too clumsy for what you want to do, but this would be very handy if you had more than one file with an extension to find. system("dir /b c:\\dir\\*.ext > c:\\filelist.txt"); Then you could read this file back in (c:\filelist.txt). Also note that you need \\ instad of \ or /, because you are submitting this to dos. Also, if that file doesn't exist, there is an error message that pops up and I don't know how to supress it. Also, this obviously will only work in Dos. When opening the files, also remember to convert the \'s to /'s when using the fstream::open.