Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!lll-winken!elroy.jpl.nasa.gov!swrinde!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!princeton!phoenix.Princeton.EDU!subbarao From: subbarao@phoenix.Princeton.EDU (Kartik Subbarao) Newsgroups: comp.unix.programmer Subject: Re: Need a little example of scandir() Message-ID: Date: 22 May 91 15:25:42 GMT References: <822@rocksanne.WRC.XEROX.COM> Sender: news@idunno.Princeton.EDU Reply-To: subbarao@phoenix.Princeton.EDU (Kartik Subbarao) Organization: American Chemical Society Lines: 41 >#include >#include > >myroutine() >{ > int numfiles,loop; > struct direct *namelist; should be struct direct **namelist; > > if ((numfiles = scandir(".", namelist, NULL, NULL)) == -1) { should be scandir(".", &namelist, NULL, NULL); ... etc > perror("myprogram"); > exit(1); > } > > for(loop = 0; loop < numfiles; ++loop) > printf("Name -> <%s>\n",namelist[loop].d_name); should be namelist[loop]->d_name >} As the man page says. It's a weird man page. -Kartik -- internet% ypwhich subbarao@phoenix.Princeton.EDU -| Internet kartik@silvertone.Princeton.EDU (NeXT mail) SUBBARAO@PUCC.BITNET - Bitnet