Findfile is v1.4a of a sample program for a file matching function.

Findfile for QB v4.5 simulates the DIR$() function in BC7 (PDS 7.10).

The first call to DIR$ using a filespec match, such as *.BI, returns the
first file found. Second and following calls to DIR$ with a Null string
returns remaining matching filespecs. Filename search ends when DIR$
return Null.

The call to the DIR$ function must include the parameters for Filename,
Filebits, Filedate$, Filetime$, and Filesize&:

Example: F$ = DIR$("*.BI", B, D$, T$, S&)

The function returns the bits of the file attribute allowing for
detection of Read-Only, Hidden, System, Archive, and Directory files.

Where the bit AND hex value is:

1 = Read-Only, 2 = Hidden, 4 = System, 10 = Directory, 20 = Archive.

Example: IF (B AND &H10)=&H10 THEN PRINT "<DIR>"

The display for attributes will show columns for R H S D A.

Findfile prompts with -more(y/n/c)- which allows input:

 y = yes
 n = no
 c = continuous

Pressing <escape> key during list aborts listing.

Findfile does not currently allow Windows long filenames, only 8.3 files.

Upgrade to v1.2a returns the file attributes.

Upgrade to v1.3a detects invalid drive and disk not ready.

Upgrade to v1.4a returns filedate, filetime, and filesize.

This code is public domain 2002.

-end-

Programming notes:

 The function is declared with:

 DECLARE FUNCTION DIR$ (Filespec$, Filebits, Filedate$, Filetime$, FileSize&)

 The usage include files are:

 REM $INCLUDE: 'dta.bi'
 REM $INCLUDE: 'qb.bi'

 The disk ready test variable is declared:

 COMMON SHARED Disk.Ready AS INTEGER

 Some simple error routine must be included which checks valid drive,
 returning the Disk.Ready variable true for invalid drive by trapping
 errors 57, 71, and 76 and is named ModuleError:

-end-
