Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

sort-order of findnext?

sort-order of findnext?

sort-order of findnext?

Naturally I use findfirst and findnext to get lists of files, and notice that dos sorts them, but the order varies from machine to machine. Presumably it's by the same mechanism as sets the order when you use dir?

I'd be deeply grateful if anyone could explain to me whether it's possible to set the sorting order from within pascal (I use Turbo pascal 6.0)...

Many thanks

RE: sort-order of findnext?

I don't think there's a specific ordering when requesting file lists; I assume files are listed in the same order as they occur in the filesystem. On some systems that could be the creation date, on others, the order in which the gaps on a fragmented drive are filled.

I never looked into this, because I just used findfirst/findnext and sorted the entries myself.

Bert Vingerhoets
Don't worry what people think about you. They're too busy wondering what you think about them.

RE: sort-order of findnext?

Oh well, just a hope. I don't drastically mind sorting myself, but just prefer to use built-in functions when they exist rather than reinventing things.
Thanks hugely. If you don't know of a way to set it, there probably isn't one.

Many thanks!

RE: sort-order of findnext?

Well, there would be a way to do that, but that wouldn't rely on findfirst/findnext. It would instead rely on the DOS command DIR, to which you could append whichever sort order you'd like. Save the info in a text file with redirection, then read your file. But that's definitely not elegant..:)



RE: sort-order of findnext?

Nice thought. Thanks. I'd sort-of been hoping that the dos dir command used sorting embedded in the int 021h side of things rather than in the command itself. I don't suppose life is always supposed to be easy.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close