Reputation: 751
Hi I am trying to write a program which uses readdir but the entries I read are not in sorted order.What else should I look for.
Upvotes: 0
Views: 350
Reputation: 11212
Try scandir
which reads the whole directory at once and can sort the names for you.
Upvotes: 1
Reputation: 15165
It is a Filesystem decision in what order it gives you the files or directories. If you want to display them sorted, you must first query all entries then sort them.
Upvotes: 0