BBS: Inland Empire Archive Date: 09-02-92 (19:51) Number: 89 From: BOB PERKINS Refer#: NONE To: TRENT SHIRLEY Recvd: NO Subj: Re: Need help checking fi Conf: (2) Quik_Bas
TS> I need suggestions on how to check for the existance of a
TS> file from Quick Basic 4.5
Using an interrupt call is the safest/easiest way I know.
Be sure to start QB with "/L".
Try this:
'$INCLUDE: 'qb.bi'
DECLARE FUNCTION Exist% (filename$)
test% = Exist%("test.txt")
IF test% THEN PRINT "File does not exist" ELSE PRINT "File exists."
FUNCTION Exist% (filename$)
testname$ = filename$ + CHR$(0)
DIM Regs AS RegType
Regs.ax = &H4E00
Regs.cx = 0
Regs.dx = SADD(testname$)
INTERRUPT &H21, Regs, Regs
Exist% = Regs.flags AND 1
END FUNCTION
--- Msg V4.5
* Origin: Reciprocity Failure (1:124/4115.236)

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