1 2 3 4 5 6 7
#include <string.h> #include <dirent.h> int alphasort(const struct dirent **a, const struct dirent **b) { return strcoll((*a)->d_name, (*b)->d_name); }