syntax help
C Wayne Huling
wayne at cs.odu.edu
Thu Mar 21 03:53:18 AEST 1991
I keep getting errors from this, I don't understand the structure used
for namelist?? How do I access this? I keep getting:
"t.c", line 14: warning: struct/union or struct/union pointer required
#include <stdio.h>
#include <sys/types.h>
#include <sys/dir.h>
main (){int numfiles,i;
struct direct *(*namelist[100]);
if ((numfiles = scandir(".",namelist,NULL,NULL)) == -1){
fprintf (stderr,"ERROR: Couldn't open directory.\n");
exit(1);
} else printf ("Yeaaaa..... \n");
fprintf(stderr,"%d \n",numfiles);
for (i=0;i<=numfiles;i++)
printf("%s\n",namelist[i]->d_name);
fflush(stdout);
}
More information about the Comp.lang.c
mailing list