Re: findfirst, findnext and finddata_t

On Wed, 16 Jan 2008 07:57:59 -0500 Linonut <linonut@xxxxxxxxxxxxx> wrote:
| * Michel peremptorily fired off this memo:
|> Hey folks,
|> I'm porting a Win32 application to linux. I'm looking for the
|> equivalent functions to _findfirst, _findnext and definitions
|> finddata_t on linux.
|> I do care about portability, so I don't think it's a good idea to use
|> the linux inherent opendir, readir, etc. to do the job instead.
|> The best thing would be to have a _findfirst, _findnext, _finddata_t
|> implementation for linux. Is there some library that already
|> implements them?
| "man ftw"

The Win32 API appears, based on the little bit posted in this thread, to
have distinct functions to get the first (probably also initiating the
tree walk) and each subsequent item. The ftw "package" does not appear
to be like that at all. Perhaps the Win32 functions have some kind of
pointer to an instance that allows the findnext function (which ftw has
no equivalent for) to work. If that is so, then it would be possible to
do two or more separate tree walks across different trees at in parallel
at the same time. The ftw function cannot do that due to the way it is
designed as a callback function.

So I suggest that ftw is not a good equivalent. I have argued in the
past that ftw should even be depricated and eventually removed. There
are better APIs available, including fts that is already included, even
though it is rather difficult to use due to so many options, as well as
my own ftr functions. You can browse the source code of these functions
directly at:
Do be sure to look at the ftr_header.h file since a number of macros
that would be used like functions are defined there.

| Phil Howard KA9WGN | |
| (first name) at | |