home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fujiology Archive
/
fujiology_archive_v1_0.iso
/
S
/
SEWER_S
/
LANGDSK1.ZIP
/
LANGDSK1.MSA
/
POWER_DE.MOS
/
DIR2STR.BAS
< prev
next >
Wrap
BASIC Source File
|
1987-04-22
|
1KB
|
57 lines
' this is an example of GEMDOS library usage. © HiSoft 1987
' the sub-program copies the filenames of files in the given directory
' into a string
'
' SCS
'
library "gemdos"
rem $option v 'variable checks on
defint a-z
dim shared dta(22) 'our DTA
do 'the main program
input path$
if len(path$)=0 then stop -1 'just hit return to quit
dirstr$=""
dir2str path$,dirstr$
print dirstr$
loop
sub dir2str(pathstr$,targstr$)
static isitthere,olddta&,addr&,hold
olddta&=FNfgetdta& 'get the old dta
fsetdta varptr(dta(0)) 'this is where we want it
isitthere=FNfsfirst(pathstr$,0) 'look for the file
if isitthere<0 then 'no files available
fsetdta olddta&
exit sub
end if
do
addr&=varptr(dta(15))
do 'look for null byte
hold=peekb(addr&)
if hold=0 then exit loop
targstr$=targstr$+chr$(hold)
incr addr&
loop
targstr$=targstr$+chr$(13)+chr$(10) 'add cr-lf
isitthere=FNfsnext 'is there another file?
if isitthere<0 then 'if not restore dta and exit
fsetdta olddta&
exit loop
end if
loop
end sub