Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!zaphod.mps.ohio-state.edu!magnus.ircc.ohio-state.edu!csn!ccncsu!mozart!barbourj From: barbourj@mozart.cs.colostate.edu (jim barbour) Newsgroups: comp.os.msdos.programmer Subject: Re: Bug in TC findfirst()/findnext()! Keywords: tc,bug,find,findfirst,findnext Message-ID: <13255@ccncsu.ColoState.EDU> Date: 27 Feb 91 16:59:02 GMT References: <1991Feb25.192823.18224@ux1.cso.uiuc.edu> <1991Feb25.152152.17353@hellgate.utah.edu> Sender: news@ccncsu.ColoState.EDU Organization: Colorado State University Lines: 38 >In article <1991Feb25.192823.18224@ux1.cso.uiuc.edu> gordon@osiris.cso.uiuc.edu (John Gordon) writes: > > I submit the following program: > ... > > 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? > > John Gordon > Internet: gordon@osiris.cso.uiuc.edu #include > gordon@cerl.cecer.army.mil #include The Turbo C Bible is wrong, i.e. its a documentation error, not a bug. Unfortunately, my TC++ manual doesn't document this "feature" very well either. My TC++ manual says something to the effect that findfirst uses dos function $4E to look up files. It also says something like "for more information about the attr field, see your dos manual." The New Peter Norton Programming Guide to the IBM PC and PS/2 says about dos function $4E: "The attribute search follows a certain logic. If you specify any combination of the hidden, system and directory attributes bits, the search matches all normal files, plus any files matching the specified attributes." My Turbo Pascal 5.5 manual says "The Attr parameter specifies the special files to include (in addition to all normal files.)" I find this kind of documentation shortfall on Borland's part often. It the one biggest complaint I have again Borland. I've never seen the Turbo C Bible, so I don't know if it has as many omissions. Jim Barbour (jwbarbour@clipr.colorado.edu)