* *
*
* * News
 • Daily news
 • Archived news

Columns
 • WildCard
 • Qbasic Articles
 • QB Comic!

Learning center
 • QB Books
 • Qbasic Lessons!
 • Qbasic FAQ
 • Newbies Section
 • Qbasic Tutorials

* *
*
*
*
*  
.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:
 
* * ** * * * *