Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!ucsd!helios.ee.lbl.gov!hellgate.utah.edu!uplherc!esunix!bgeer From: bgeer@esunix.UUCP (Bob Geer) Newsgroups: comp.lang.pascal Subject: Re: Findfirst Message-ID: <2075@esunix.UUCP> Date: 20 Jul 90 13:18:57 GMT References: <1990Jul13.232754.29083@dhw68k.cts.com> Organization: Evans & Sutherland, Salt Lake City, Utah Lines: 72 X-Local-Date: 20 Jul 90 06:18:57 PDT From article <1990Jul13.232754.29083@dhw68k.cts.com>, by silk@dhw68k.cts.com (Mitch Gorman): > In article <23854@adm.BRL.MIL> elric%FSU@pucc.princeton.edu (Commodore 128 User) writes: >> You need to have it search for 'archive' type files. [...] >... > The smart way to do this, guaranteed to find any and all honest-to-god > files, is "findfirst(..., anyfile - directory - volumeid, ...);". > Back in the Turbo Pascal 1 & DOS 2 days I wrote a directory browser using DOS software interrupt calls since there was no "findfirst()" library procedure. I have listed below the file attribute byte breakdown, a code fragment that searches for either all files or non-hidden, non-system files (volume label & sub-dirs were handled specially), and the breakdown of the FCB & DTA records, that resulted from that experience. Hopefully seeing this stuff will shed some light on directory searches from within a program. BG -- Bear-person _______________________________________________________________________________ CONST READ_ONLY = $01 ; { file attribute byte map } HIDDEN = $02 ; { " } SYSTEM = $04 ; { " } VOLUME_LABEL = $08 ; { " } SUB_DIRECTORY = $10 ; { " } ARCHIVE = $20 ; { " } VAR { local } attributes : BYTE ; IF write_all_files THEN attributes := $FF - VOLUME_LABEL - SUB_DIRECTORY { everything! } {attributes := ARCHIVE + READ_ONLY + SYSTEM + HIDDEN} ELSE attributes := ARCHIVE + READ_ONLY ; TYPE FCB_RECORD = RECORD { used by DOS 1.x filing calls } extended_fcb_flag : BYTE ; unused1 : ARRAY [2..6] OF BYTE ; attribute : BYTE ; fcb_drive_number : BYTE ; file_name : ARRAY [1..8] OF BYTE ; extension : ARRAY [9..11] OF BYTE ; block_number : INTEGER ; record_size : INTEGER ; low_size : INTEGER ; high_size : INTEGER ; created_date : INTEGER ; reserved1 : ARRAY [22..31] OF BYTE ; seq_record_no : BYTE ; low_ran_record_no : INTEGER ; high_ran_record_no : INTEGER ; END ; DTA_RECORD = RECORD { used by DOS 2.x filing calls } used_by_dos : ARRAY[1..21] OF BYTE ; attribute : BYTE ; time : INTEGER ; date : INTEGER ; low_size : INTEGER ; high_size : INTEGER ; file_name : FILE_NAME ; END ; -- <> Bob Geer <> at decwrl!esunix!bgeer or utah-cs!esunix!bgeer <> <> Bear-person <> speaking only for myself, one of my many tricks <> <> Salt Lake City, <> "We must strive to be more than we are, Lal." <> <> Ootah <> -- Cmdr. Data, learning schmaltz <>