From: "Andrew Hurrell" <andrew AT amh-consulting DOT freeserve DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: File listing
Date: Wed, 2 Feb 2000 00:15:11 -0000
Organization: Customer of Planet Online
Lines: 27
Message-ID: <87ahac$9k1$1@newsg4.svr.pol.co.uk>
References: <200002022203 DOT OAA01009 AT www1 DOT xoommail DOT com> <76fh9scttgn0k3lfi45equ7a80uopkg97j AT 4ax DOT com>
NNTP-Posting-Host: modem-186.hippo-tang.dialup.pol.co.uk
X-Trace: newsg4.svr.pol.co.uk 949536908 9857 62.137.28.186 (3 Feb 2000 00:15:08 GMT)
NNTP-Posting-Date: 3 Feb 2000 00:15:08 GMT
X-Complaints-To: abuse AT theplanet DOT net
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2014.211
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2014.211
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com


Damian Yerrick wrote

> >I am curious as to how to list the files in a
> >directory to the screen, or into an array, like a
> >file open window.  Could somebody give me some
> >ideas?
>
> Look in the libc docs for findfirst() or look in the Allegro docs for
> for_each_file().
>

Or you could use the functions in dirent.h

e.g.

DIR *d = opendir("your_directory");
struct dirent *de;

while((de = readdir(d)))
      name[k++] = strdup(de->d_name);

closedir(d);

ANDREW