Sort order of dirEntries
Regan Heath
regan at netmail.co.nz
Fri Oct 26 07:51:14 PDT 2012
On Thu, 25 Oct 2012 01:15:06 +0100, Joseph Rushton Wakeling
<joseph.wakeling at webdrake.net> wrote:
> Hello all,
>
> I've just been playing with dirEntries and by the looks of it, it
> returns these entries in arbitrary order.
On windows, assuming it was using FindFirstFile or similar you would get
alphabetical order on some platforms/file systems and FAT table order on
others. I imagine linux and associated platforms have similar behaviour.
> Is there a way to get it to sort the entries in alphabetical order,
> other than the obvious one of storing them in an array and sorting
> that? (This is untenable because I'm talking about a lot of files...:-)
To get a sorted list someone has to load all the entries and sort them. I
doubt the file system is going to do it, so either the library routine
would have to, or you're going to have to. As most file systems and
libraries should take the most efficient approach first and foremost it's
likely you're going to have to do it yourself.
:)
R
--
Using Opera's revolutionary email client: http://www.opera.com/mail/
More information about the Digitalmars-d-learn
mailing list