| www.delorie.com/archives/browse.cgi | search |
| From: | Jean-Gaël GRICOURT <jean-gael DOT gricourt AT snet DOT net> |
| 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 |
| 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 <stdio.h>
#include <dirent.h>
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");
}
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |