TP> I am still using QB45 and need to know how to check for the existance
TP> file.. other than being sloppy and using something like:
Well I'm sure the moderator will let you know this is the PowerBASIC
support echo, not QB 4.5 support, so I won't go into it. PB has a
function called DIR$ which will return a empty string if the file does
not exist, and a filename if it does. I needed such a function for a
QBASIC program I was writing (I distribute 'helper' utilities for my
door program as qbasic source code so it doesn't make for large files
due to compiled exe's) so wrote this. The interrupt call for qbasic
was found on the QuickBas echo. you'll have to implement QB 4.5 method
of doing these, of which I have no idea how to do. Eric
FUNCTION DIR$ (infile$) STATIC
DIM f AS STRING * 128
f = infile$ + CHR$(0)
regs.AX = &H4E00
regs.CX = 0
regs.DX = VARPTR(f)
regs.DS = VARSEG(f)
CALL intrptx(&H21, regs, regs)
IF regs.flags AND 1 THEN DIR$ = "" ELSE DIR$ = infile$
END FUNCTION
So its use is as
if dir$("filename.ext") = "" then
print "can't find file"
else
open .....
end if
--- QM v1.00
---------------
* Origin: Creekside Manor (805) 484-8016 CdCom Support BBS (1:206/2512.0)
|