delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/04/14/19:33:17

From: "John M. Aldrich" <fighteer AT cs DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Searching the path.
Date: Tue, 14 Apr 1998 18:26:18 -0400
Organization: Two pounds of chaos and a pinch of salt.
Lines: 23
Message-ID: <3533E28A.5C53@cs.com>
References: <tg DOT 7 DOT 000E2F07 AT hempseed DOT com>
NNTP-Posting-Host: ppp203.cs.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Trent Gamblin wrote:
> 
> Can anyone tell me how I can search the path for a file if it isn't in the
> current directory? Also, I know how to get a list of files in a directory
> but how can I distinguish between regular files and directories?

The library function access() can tell you what flags a given file has,
and so can the ff_attrib field of 'struct ffblk' used by
findfirst()/findnext().

For path searching, look at the searchpath() function declared in
<dir.h>.  It mimics the behavior of the Borland function of that name. 
If you want to convert the code for your own use, it's in
src/libc/dos/dir/srchpath.c (you need djlsr201.zip for the library
sources).

-- 
---------------------------------------------------------------------
|      John M. Aldrich       | "A woman is not property, and hus-   |
|       aka Fighteer I       | bands who think otherwise are living |
|   mailto:fighteer AT cs DOT com   | in a dreamworld."                    |
| http://www.cs.com/fighteer |                - Lazarus Long        |
---------------------------------------------------------------------

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019