does scandir work under xfs?
here is a copy of the code that I'm trying to run that's not working...
the printf where I'm printing out the value of j is showing up as 0 no
matter what directory is passed to scandir. Am I doing something wrong
or is this function deprecated? I've been searching through the kernel
source for it, and I can't seem to find it defined anywhere...
int main(int argc, char *argv[])
{
int j,i;
struct dirent **curdir;
if(argc != 2){
fprintf(stderr,"guess what you did wrong\n");
exit(1);
}
if((j=scandir(argv[1], &curdir, 0, alphasort) < 0)) {
perror("scandir");
exit(1);
}
printf("%d\n", j);
for(i=0; i<j; i++){
printf("%s\n", curdir[i]->d_name);
free(curdir[i]);
}
free(curdir);
return 0;
}
thanks...
|