🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.msdos.programmer
Article #4890

Re: Bug in TC findfirst()/findnext()!

#4890
From: anto
Date: Tue, 26 Feb 1991 10:12
38 lines
1843 bytes
In article <1991Feb25.192823.18224@ux1.cso.uiuc.edu>, 
gordon@osiris.cso.uiuc.edu (John Gordon) writes:
> 
> 	I submit the following program:
> 
> ----------

[... code deleted ...]

> 	According to the _Turbo_C_Bible_, calls to findfirst() and findnext()
> are supposed to return filenames that match *both* the given path *and* the
> given attribute.  However, the above program, which clearly specifies the
> *directory* attribute (FA_DIREC), finds both directories *and* plain files.
> Anyone have any comments/fixes/etc?

The TC manual entry for findfirst tells me to check the DOS manual, so I did.
MS-DOS Encyclopedia has the following for INT 21h Func 4Eh (Find First File):

...
The attribute word in CX controls the search as follows:
- If the attribute word os 00H, only normal files are included in the search.
- If the attribute word has any combination of bits 1, 2, and 4 (hidden, sys-
  tem, and subdirectory bits) set, the search includes NORMAL FILES as well as
  files with any of the attributes specified. [Emphasis mine]
- If the attribute word has bit 3 set (volume-label bit), only a matching 
  volume label is returned.
- Bits 0 and 5 (read-only and archive bits) are ignored by Function 4EH.
...

I hope this clears up any confusions.

> John Gordon
> Internet: gordon@osiris.cso.uiuc.edu        #include <disclaimer.h>
>           gordon@cerl.cecer.army.mil       #include <clever_saying.h>

Regards,

Anto.
Technical Details
Message-ID: <1991Feb26.101818.45365@vaxb.acs.unt.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!solo.csci.unt.edu!vaxb.acs.unt.edu!anto
References: <1991Feb25.192823.18224@ux1.cso.uiuc.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!solo.csci.unt.edu!vaxb.acs.unt.edu!anto
From: anto@vaxb.acs.unt.edu
Newsgroups: comp.os.msdos.programmer
Subject: Re: Bug in TC findfirst()/findnext()!
Message-ID: <1991Feb26.101818.45365@vaxb.acs.unt.edu>
Date: 26 Feb 91 10:12:18 GMT
References: <1991Feb25.192823.18224@ux1.cso.uiuc.edu>
Lines: 38