From: Jean-Gaël GRICOURT Newsgroups: comp.os.msdos.djgpp Subject: Readdir() bug ? Date: Tue, 26 Nov 1996 23:41:40 -0500 Organization: A customer of SNET Internet: http://www.snet.net/ Lines: 24 Message-ID: <329BC684.DB0@snet.net> Reply-To: jean-gael DOT gricourt AT snet DOT net NNTP-Posting-Host: brpt01-sh1-port10.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 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 ".." it 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"); }