Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!bloom-beacon!adam.pika.mit.edu!scs From: scs@adam.pika.mit.edu (Steve Summit) Newsgroups: comp.lang.c Subject: Re: Trying to C a directory. Summary: Use opendir and readdir Keywords: DOS, opendir, readdir Message-ID: <11708@bloom-beacon.MIT.EDU> Date: 28 May 89 01:19:27 GMT References: <236100013@mirror> <708@marob.masa.com> Sender: daemon@bloom-beacon.MIT.EDU Reply-To: scs@adam.pika.mit.edu (Steve Summit) Lines: 24 In article <236100013@mirror> root@mirror.TMC.COM (Patrick McCartney) writes: >I am having trouble trying to figure out how to read a directory in >MS-DOS. I would like to be able to read in the directory contents... In article <708@marob.masa.com> manes@marob.masa.com (Steve Manes) writes: >Why I Like Turbo-C: it has the two functions you need, findfirst and >findnext, already in the libraries. There's also an example. >Alternatively, you will essentially need to recreate these functions >with DOS service calls. If you are at all interested in portability, the functions you need are called opendir, readdir, and closedir, which neither Microsoft nor (apparently) Borland have seen fit to provide. These routines are in the POSIX standard and are the universally recommended way of reading directories from within a C program. Several implementations of MS-DOS opendir/readdir exist: I have written one or two, which I can supply upon request; I have given mine to Doug Gwyn for inclusion in his posted opendir/readdir package; I have also heard that the FSF has an implementation so that their tools can be ported to MS-DOS (if you have enough memory :-) ). Steve Summit scs@adam.pika.mit.edu