Path: utzoo!mnetor!uunet!lll-winken!lll-lcc!lll-tis!ames!ptsfa!ihnp4!att-cb!mandrill!hal!ncoast!axcess!allbery From: allbery@axcess.UUCP (Brandon S. Allbery) Newsgroups: comp.sys.att Subject: Re: Seeking a method to "read" a DOS directory Message-ID: <155@axcess.UUCP> Date: 17 Feb 88 13:50:25 GMT References: <902@cblpe.ATT.COM> Organization: aXcess Company, Mentor, Ohio Lines: 27 Summary: An interface like BSD dir(3) can be built from the "find first" and "find next" wildcard DOS calls. In article <902@cblpe.ATT.COM>, jrm@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/