Mail Archives: djgpp/1998/04/04/17:08:42
In a message dated 98-04-04 13:42:26 EST, fighteer AT cs DOT com writes:
> Myknees wrote:
> >
> > It looks like it should find and show subdirectories, but it shows all
the
> > files, including the ones whose ff_attrib != FA_DIREC. Confusion. One
> weird
> > thing is that using -1 as the attrib makes the program not output
anything.
>
>
> What you've described is the standard defined behavior of
> findfirst()/findnext() according to the libc docs:
>
> Any file that doesn't have any flag bits that aren't specified is
> selected for the search.
That is the part that I don't get: if I only specify FA_DIREC, then that's 16
decimal, 0x10. The flag bit for FA_ARCH is 0x20 and has not been specified
for the search.
"Any file that doesn't have any flag bits that aren't specified is
selected for the search."
That implies that the regular files meet the qualification for exclusion. The
regular files have flag bits (0x20). So the regular files do have a flag bit
that isn't specified in the attrib parameter, and it seems like the docs are
saying that those files should be excluded.
> Thus, if you specified `FA_DIREC' and
> `FA_LABEL', you would get all subdirectories, the volume label, and
> any file that is neither read-only or modified.
> Apparently, there's no way to make findfirst() _not_ list all ordinary
> files.
>
> However, you said yourself that the value of f.ff_attrib is 16 for
> directories and 32 for files; it's simple enough to just ignore any
> entries with values other than 16.
True. It's not hard to do that, it's just that I thought that something must
be going wrong.
--Ed (Myknees)
- Raw text -