how to use scandir()?
wyuen at CAE.WISC.EDU
wyuen at CAE.WISC.EDU
Tue Aug 28 03:47:30 AEST 1990
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; i<n; i++)
printf("filename = %s\n", (*namelist[i])->d_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.
More information about the Comp.unix.questions
mailing list