delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/04/04/17:08:42

From: Myknees <Myknees AT aol DOT com>
Message-ID: <702a8615.3526ad8f@aol.com>
Date: Sat, 4 Apr 1998 17:00:45 EST
To: fighteer AT cs DOT com
Cc: djgpp AT delorie DOT com
Mime-Version: 1.0
Subject: Re: findfirst attrib parameter -- I must be missing something

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 -


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