Path: utzoo!attcan!uunet!munnari.oz.au!csource!david From: david@csource.oz.au (david nugent) Newsgroups: comp.lang.c Subject: Reading MS-DOS directory in C, how to Message-ID: <45.25D9745B@csource.oz.au> Date: 15 Feb 90 05:12:21 GMT Organization: Unique Computing Pty Limited (Vic) Lines: 44 > Message-ID: <1990Feb14.031640.28944@usenet.ins.cwru.edu> > > I would like to read the current directory in a C program, but either > the books I have been reading (the Turbo C reference and my library of > beginner's books on the language) don't mention it, or I don't know > where in the index to look. I assume there's some call that returns > an array of pointers to strings, but I really can't figure it out. Hmm, no. Turbo C should include a findfirst() and findnext() functions, which allow you to pass both a file "specification" and attributes. It's usually done something like this (node that the given path can include wildcards): . . #include #include . . . { int j; struct ffblk ff; /* contains directory data */ j = findfirst ("*.*", &ff, FA_RDONLY|FA_HIDDEN|FA_SYSTEM|FA_DIREC); while (j) { /* store information or do whatever */ j = findfirst (&ff); } . . david -- uucp: ...!munnari!csource!david internet: david@csource.oz.au Via FidoNet 3:632/348, Melbourne, Australia.