Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sort-order of findnext?

Status
Not open for further replies.

lionelhill

Technical User
Dec 14, 2002
1,520
GB
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
 
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.

Regards,
Bert Vingerhoets
vingerhoetsbert@hotmail.com
Don't worry what people think about you. They're too busy wondering what you think about them.
 
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!
 
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..:)



Cheers,

Realm174
 
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.
Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top