qb45advr.hlp (Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
ERDEV and ERDEV$ Function Programming Example
  QuickSCREEN      Details     Example      Contents      Index
──────────────────────────────────────────────────────────────────────────────
ERDEV and ERDEV$ Function Programming Example
 
This example prints the values of ERDEV and ERDEV$ after the program
generates an error attempting to open the file A:JUNK.DATA. Press
the F4 function key to view the program output.
 
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 dies.
 
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: