Seeking a method to "read" a DOS directory

John Miller jrm at cblpe.ATT.COM
Thu Feb 11 02:10:15 AEST 1988


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.

This seems like a gross oversight on Microsoft's part.

The best method I know of so far (and this is more of an attack plan than
a sure and tried solution) - is to use a DOS interrupt function to gain
information about the FAT. From that information, I should be able to
calculate the location, on disk, of the beginning sector containing
the DOS directory table. Once in the table, I should be able to traverse
through the chains to find all the files that are in the directory I
am interested in.

Yuuck! There has to be a better way! I could see where, after weeks of work,
I could make this scheme work - for all disk types and formats. The price
is very high!

Does anyone know of a better way? More direct? I would be more that willing
to attach an assembler routine to the 'C' product I am building (I have
2 already part of the product). But from what I can tell, there is nothing
available anywhere, at any level that can help - have I overlooked something?

-- 
               J.R. Miller, AT&T Bell Labs, Columbus, OH
                      CB 1C-339 (614) 860-4314
			ihnp4!cblpe!jrm



More information about the Comp.sys.att mailing list