' This is an example of an Error Handling routine which can be used to help
' keep your programs from crashing from a simple oversight.
' This example will try to write to a disk, so you may wish to place a
' BLANK formatted floppy in drive A. Make sure that the WRITE-PROTECT notch
' is OPEN (so that you CANNOT write to it).
'
'
ALERT 1,"|Are you ready to write |to disk A:\*.* ..? ",1," Yes | No ",a
IF a=1
  GOTO written
ELSE
  EDIT
ENDIF
'
written:
ON ERROR GOSUB oops            !If there's an error go to PROCEDURE oops
test$="A:\TEST.TXT"            !The name of the file & where it is
DEFMOUSE 2                     !cursor is bee shape
OPEN "O",#1,test$              !Open file
PRINT #1,"This is a test..."   !write to it
CLOSE #1                       !close it
'
help_me:
DEFMOUSE 0                     !cursor is arrow shaped
ALERT 1,"|We'll be quitting now... ",1," Aww ",a
EDIT
'
PROCEDURE oops
  ~FORM_ALERT(1,ERR$(ERR))  !Prints appropriate ERROR message (*Write Protected)
  RESUME help_me            !Resume program AFTER the point in which the error
RETURN                      !was encountered.
