BBS: Inland Empire Archive Date: 10-21-92 (12:39) Number: 333 From: RICHARD DALE Refer#: NONE To: VICTOR YIU Recvd: NO Subj: Re: Error checking in QB Conf: (2) Quik_Bas
VY>For example -- if you are opening a file, I would trap an error -- VY>AND NOT test for the ERR. I would just do something like: "Error VY>opening file." and quit. VB/DOS has a nice thing for doing things Good idea! There are tons of "file exist" routines around, such as ===================================================== CONST False = 0, True = NOT False '$INCLUDE: 'qb.bi' DECLARE FUNCTION FileExists% (FileSpec AS STRING) DIM FileToCheck AS STRING FileToCheck = "filename.txt" IF FileExists(FileToCheck) THEN PRINT FileToCheck; " exists" ELSE PRINT "Can't find ";FileToCheck END IF END FUNCTION FileExists% (FileSpec AS STRING) STATIC DIM ASCIIZ AS STRING, Reg AS RegTypeX LET ASCIIZ = FileSpec + CHR$(0) LET Reg.AX = &H3D00 LET Reg.DS = VARSEG(ASCIIZ) LET Reg.DX = SADD(ASCIIZ) InterruptX &H21, Reg, Reg IF Reg.Flags AND 1 THEN FileExists% = False ELSE LET Reg.BX = Reg.AX LET Reg.AX = &H3E00 InterruptX &H21, Reg, Reg FileExists% = True END IF END FUNCTION VY>... Pardon Me, But Would You Have Any Blue Poupon? Ha ha ha ha ha ha ha ha ha! * 1st 1.01 #567 * If guns are outlawed, how will liberals collect taxes? --- FidoPCB v1.2 [ff013/c] * Origin: Sound Advice - 24 Nodes (816)436-4516 (1:280/333)
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