BBS: Inland Empire Archive Date: 08-02-92 (18:55) Number: 120 From: JEAN CREPEAU Refer#: NONE To: AL LAWRENCE Recvd: NO Subj: Dir Display/Manipulation Conf: (2) Quik_Bas
In a message to ALL, AL LAWRENCE wrote:
AL=> I believe there was some code posted in this echo relative to
retrieving a Directory listing and manipulating the individual files
(copying them to another Dir, etc)via cursor movement.
AL=> If my memory is correct (which at times is suspect <g>) please let me
know where I can find it....
Here is what you're asking for.
deflng a-z
'$INCLUDE: 'qb.bi'
type filedesc
reserved as string*21
attr as string*1
filetime as integer
filedate as integer
filesize as long
filename as string*13
end type
dim dta as filedesc
declare function findfirst%(x$,dta)
declare function findnext%()
function findfirst%(x$,dta as filedesc)
dim inreg as regtype,outreg as regtype,temp as string
inreg.ax=&h1a00
inreg.dx=varptr(dta)
interrupt &h21,inreg,outreg
temp=x$+chr$(0)
inreg.ax=&h4e00
inreg.cx=-1
inreg.dx=sadd(temp)
interrupt &h21,inreg,outreg
findfirst=outreg.flags and 1
end function
function findnext%
dim inreg as regtype,outreg as regtype
inreg.ax=&h4f00
interrupt &h21,inreg,outreg
findnext=outreg.flags and 1
end function
To get the first filename in the directory:
R=FindFirst("*.*",dta)
If R=0 then everything is ok. To read the next file name in the
directory:
R=FindNext
If R<>0, that means that there is no more file in the directory.
Jean
---
* Origin: INTERACESS Montreal (QC) Canada (514) 528-1415 (1:167/280)

Books at Amazon:
Back to BASIC: The History, Corruption, and Future of the Language
Hackers: Heroes of the Computer Revolution (including Tiny BASIC)
Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution
The Advent of the Algorithm: The Idea that Rules the World
Moths in the Machine: The Power and Perils of Programming
Mastering Visual Basic .NET