Revision [14132]

This is an old revision of KeyPgErr made by CountingPine on 2009-04-26 22:46:10.



Error handling function to return the error number of the last error

result = Err

Return Value:
After an error, returns the error code that occurred.

Err can always be used, even if QB-like error handling is not enabled.
NOTE: KeyPgPrint Print Err after an error occurred may end up printing 0, because KeyPgPrint Print sets a new Err value when executed. To print an Err value it should be first copied to an auxiliary variable and print that one.
See TblRuntimeErrors Runtime Error Codes for a listing of runtime error numbers and their associated meaning.

An example using QBasic style error handling (compile with -ex option)
'' Compile with -lang fblite or qb

#lang "fblite"

On Error Goto Error_Handler
Error 150

  n = Err
  Print "Error #"; n
  Resume Next

An example using inline error handling
Dim a As String

    Line Input "Input filename: ", a
    If a = "" Then End
    Open a For Input As #1
Loop Until Err = 0

Print "File " & a & " opened successfully"
Close #1

Differences from QB:
See also:
Back to Error Handling Functions
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki phatcode