10-30-2002, 07:23 PM
You mean, if the file which the user entered is not found, the file should be created?, if so:
Ok, this is what it does:
If the file was not found, it prints out "File not found.", "Creating file: Somefile"
Then it creates the file, and tries to reopen the file again, using RESUME.
RESUME resumes the code line where the error occured.
Code:
ON ERROR GOTO ErrorHandler
INPUT "File:"; File$
OPEN File$ FOR INPUT AS #1
CLOSE #1
ErrorHandler:
SELECT CASE ERR
CASE 53
PRINT "File not found."
PRINT "Creating file:"; File$
OPEN File$ FOR OUTPUT AS #1
CLOSE #1
RESUME
CASE 64
PRINT "The file name you entered was incorrect."
CASE 76
PRINT "Path not found."
END SELECT
' untested
If the file was not found, it prints out "File not found.", "Creating file: Somefile"
Then it creates the file, and tries to reopen the file again, using RESUME.
RESUME resumes the code line where the error occured.
isit Blind Coding