• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 339
  • Last Modified:

readdir()

hi

i'm using the readdir sys call to read entries from a dir
how do i get the entries sorted on timestamp ?

Suresh
0
nsuresh
Asked:
nsuresh
1 Solution
 
rdelfinoCommented:

Sorry, but readdir() doesn't sort the entries.
If you want any kind of sorting , do it yourself.

Reginaldo
0
 
zbangCommented:
To understand why readdir doesn't do any sorting you must first understand that a directory is nothing more than a sequential file.
readdir() only returns individual records from this file in the same order that they have been written.
In order to get the directory sorted by any order you have to read all of the entries to a buffer and do the sorting using your favorite sorting algorythm.
0
 
nsureshAuthor Commented:
thanx a lot
0

Featured Post

[Webinar] Improve your customer journey

A positive customer journey is important in attracting and retaining business. To improve this experience, you can use Google Maps APIs to increase checkout conversions, boost user engagement, and optimize order fulfillment. Learn how in this webinar presented by Dito.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now