Seeking a method to "read" a DOS directory

Brandon S. Allbery allbery at axcess.UUCP
Wed Feb 17 23:50:25 AEST 1988


In article <902 at cblpe.ATT.COM>, jrm at cblpe.ATT.COM (John Miller) writes:
+---------------
| Hi, in a UNIX environment (using the 'C' language), it is possible to "open"
| a directory. The result is a list of the files that are in the particular
| directory - very straightforward.
| 
| I would like obtain a list of files that are in a DOS directory using
| Microsoft 'C', version 4 or 5. Near as I can tell, you are not permitted
| to "open" a directory in dos. Further, I have not been able to find a
| function in the MSC library, or a function in the DOS or BIOS library
| that will permit me to find out what files are in a given directory.
+---------------

First -- System V allows you to open a directory as a file, and acts as you
say.  While you can open a BSD directory as a file, it's less than useful; so
there are special directory-reading calls available.  These have been ported
to System V and even to DOS; they went through comp.sources.misc a few months
ago.

Second -- You can emulate directory reading by using the "find first" and
"find next" system calls (DOS FC 4EH and 4FH, respectively) with a filename of
"*.*".  This is how the BSD-compatible library is done.
-- 
 ___  ________________,	Brandon S. Allbery	       cbosgd \
'   \/  __   __,  __,	aXcess Company		       mandrill|
 __  | /__> <__  <__	6615 Center St. #A1-105		       !ncoast!
/  ` | \__. .__> .__>	Mentor, OH 44060-4101	       necntc  | axcess!allbery
\___/\________________.	Moderator, comp.sources.misc   hoptoad/



More information about the Comp.sys.att mailing list