alphasort

Name

alphasort -- scan a directory for matching entries

Synopsis

#include <dirent.h>

int alphasort(const struct dirent **a, const struct dirent **b);

Description

The alphasort() function can be used as the comparison function for the scandir() function to sort the directory entries into alphabetical order. Its parameters are the two directory entries, a and b, to compare.

Return Value

The alphasort() function returns an integer less than, equal to, or greater than zero if the first argument is considered to be respectively less than, equal to, or greater than the second.

Errors

ENOMEM

Insufficient memory to complete the operation.