BBS: Inland Empire Archive
Date: 07-19-92 (19:49) Number: 29
From: JEAN CREPEAU Refer#: NONE
To: ERIC FORD Recvd: NO
Subj: Another Question Conf: (2) Quik_Bas
In a message to ALL, ERIC FORD wrote:
EF=> Hey, is there anyway I could get a file listing of certain files (like
any file with one of three extensions) without having to use
EF=> files "*.dat" : files "*.res" : files "*.con"
EF=> Maybe a string for each filename so I could remove the extension?
EF=> Sorry I'm a GWBasic programer who has never spent the time to convert.
Well, if you program in GW-Basic, I can't really help you. You have
to load a machine-language program into memory and it's very complicated.
If you use QuickBASIC. Just use the following functions.
reserved as string*21
attr as string*1
filetime as integer
filedate as integer
filesize as long
filename as string*13
dim dta as filedesc,inreg as regtype,outreg as regtype
declare function findfirst%(x$,dta)
declare function findnext%()
function findfirst%(x$,dta as filedesc)
dim inreg as regtype,outreg as regtype,temp as string*128
findfirst=outreg.flags and 1
dim inreg as regtype,outreg as regtype
findnext=outreg.flags and 1
To find a file, you must:
1. X=FindFirst(filnam$,dta), where filnam$ is the name of your file (you
can specify an entire pathname like D:\TESTDIR\*.DAT with * and ?)
2. If X>0, FILE NOT FOUND; the file doesn't exist; end.
3. The filename (without * and ?) is in DTA.filename terminated by a NUL
(&h00) character. Store or display that filename.
5. If X>0, there is no more file of that name; end.
6. Go back to step #3
You can also skip step #5 and go back to step #2 instead, if you do
not need a separate message or status for a file not found. Then the
message at step #2 should be `NO MORE FILES'.
* Origin: INTERACESS Montreal (QC) Canada (514) 528-1415 (1:167/280)