I'm using scandir function in my application running on Red Hat Linux. Here I found that the prototype of compare function is different than the man page in man page it is showing -
int scandir(const char *dir, struct dirent ***namelist,
int(*filter)(const struct dirent *),
int(*compar)(const struct dirent **, const struct dirent **));
but in dirent.h it is
extern int scandir (__const char *__restrict __dir,
struct dirent ***__restrict __namelist,
int (*__selector) (__const struct dirent *),
int (*__cmp) (__const void *, __const void *))
Look at the prototype of compare function. in my code changed compare function prototype as declared on dirent.h file. But I'm not getting desired result on Red Hat. Is there any problem in scandir()? Not sure, due to that I'm getting coredump. Please HELP me.
Any help will be appriciated. Thanks in advance.