www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/01/17/05:16:26

Date: Sun, 17 Jan 1999 12:15:01 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Tim Hoskins <hoskinst AT cadvision DOT com>
cc: djgpp AT delorie DOT com
Subject: Re: Alphabeticallize _dos_findfirst and _dos_findnext?
In-Reply-To: <01be403b$7951ba80$0100007f@tim-hoskins>
Message-ID: <Pine.SUN.3.91.990117121444.278O-100000@is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com

On 14 Jan 1999, Tim Hoskins wrote:

> Is there a way to have _dos_findfirst() and _dos_findnext() return the
> files alphabetically?

Yes: sort them.  `_dos_findfirst'/`_dos_findnext' return the files in
the order they are stored in the directory.  A library function
`qsort' is the usual way of sorting strings.

One easy way of getting a sorted list is by calling the library
function `glob', because it sorts the files for you (`glob' calls
`findfirst' and `findnext' internally).

And btw, don't use _dos_findfirst/_dos_findnext, use
findfirst/findnext instead.  The former don't support long file names
on Windows 9X.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019