08-22-2005, 02:20 AM
My method is to use ON ERROR with OPEN...FOR INPUT -
[syntax="QBasic"]ON ERROR GOTO fileNotFound
OPEN "folder\fileName.ext" FOR INPUT AS #1: CLOSE #1
'{program goes here}
END 'END must be here unless you want to run your error handling section, even if there are no errors
fileNotFound:
IF ERR = 53 THEN PRINT "File Not Found. Ending program.": END[/syntax]
I hope that helps!
[syntax="QBasic"]ON ERROR GOTO fileNotFound
OPEN "folder\fileName.ext" FOR INPUT AS #1: CLOSE #1
'{program goes here}
END 'END must be here unless you want to run your error handling section, even if there are no errors
fileNotFound:
IF ERR = 53 THEN PRINT "File Not Found. Ending program.": END[/syntax]
I hope that helps!
974277320612072617420666C61696C21 (Hexadecimal for those who don't know)