Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!ucsd!ucbvax!CAE.WISC.EDU!wyuen From: wyuen@CAE.WISC.EDU Newsgroups: comp.unix.questions Subject: how to use scandir()? Message-ID: <9008271747.AA02292@ws-38.cae.wisc.edu> Date: 27 Aug 90 17:47:30 GMT Sender: daemon@ucbvax.BERKELEY.EDU Lines: 17 Could someone give examples of how to use scandir? Eg., how to list the filenames of a given directory? It seems to me that struct direct *(*namelist[]); is a reasonable declaration, n = scandir(".", namelist, NULL, NULL) is a reasonable call, for (i=0; id_name); is a reasonable use, however, I'm getting Segmentation Faults all the time. Someone kindly points out what I did wrong? Thanks. Please send to newsgroup as my email is unstable.