From: Jean-Gaël GRICOURT Newsgroups: comp.os.msdos.djgpp Subject: Readdir() function ? Date: Tue, 26 Nov 1996 13:11:52 -0500 Organization: A customer of SNET Internet: http://www.snet.net/ Lines: 29 Message-ID: <329B32E8.793@snet.net> Reply-To: jean-gael DOT gricourt AT snet DOT net NNTP-Posting-Host: brpt01-sh1-port29.snet.net Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp The function readdir() from dirent.h doesn't seems to work very well ? Try it with these arguments : - no argument -> memory fault. - arg="\" -> don't list the root of the disk. - arg=".." -> don't list the root if ".." is really linked to the root. #include #include void main(int argc,char **argv) { DIR *d; struct dirent *dr; if((d=opendir(argv[1]))!=NULL) { while((dr=readdir(d))!=NULL) printf("%s\n",dr->d_name); closedir(d); } else perror("opendir"); } mailto://jean-gael DOT gricourt AT snet DOT net