ERDEV, ERDEV$ Function Programming Example
◄Example► ◄Contents► ◄Index► ◄Back►
──────────────────────────────────────────────────────────────────────────────
'This example prints the values of ERDEV and ERDEV$ after the program
'generates an error attempting to open a text file.
DEFINT A-Z
'Indicate first line of error handler.
ON ERROR GOTO ErrorHandler
'Attempt to open the file.
OPEN "A:JUNK.DAT" FOR INPUT AS #1
END
'Error handling routine.
'Prints values of ERDEV and ERDEV$ and returns error control to BASIC.
ErrorHandler:
PRINT "ERDEV value is "; ERDEV
PRINT "Device name is "; ERDEV$
ON ERROR GOTO 0
'Sample Output
'
'Running the program with drive A unlatched produces the following
'output (2 is the DOS error code for "Drive not ready"):
'
'ERDEV value is 2
'Device name is A: