From: "John M. Aldrich" Newsgroups: comp.os.msdos.djgpp Subject: Re: findfirst attrib parameter -- I must be missing something Date: Sat, 04 Apr 1998 13:34:02 -0500 Organization: Two pounds of chaos and a pinch of salt. Lines: 28 Message-ID: <35267D1A.44CA@cs.com> References: <35256D08 DOT 5B85 AT cs DOT com> <1998040417130700 DOT MAA06105 AT ladder03 DOT news DOT aol DOT com> NNTP-Posting-Host: ppp247.cs.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk 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. 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. -- --------------------------------------------------------------------- | John M. Aldrich, aka Fighteer I | mailto:fighteer AT cs DOT com | | ICQ UIN#: 7406319 | http://www.cs.com/fighteer/ | | ObJoke: If Bill Gates were a robber, not only would he | | shoot you, but he'd send you a bill for the bullets. | ---------------------------------------------------------------------