UERROR Function

The UERROR( ) function returns the error number that resulted from the previous Inter-Operating System command.

Format

UERROR( )

Description

If an Inter-Operating System command fails, a positive integer code indicating the reason for the failure is stored for access by UERROR. If the command is successful, the error code is zero.

UERROR reports return status codes resulting from the last mvBASIC Inter-Operating System Statement. Exceptions are UEXECUTE, UWAITFOR and UMESSAGE.

Example

The following example opens the file \library\book1.txt for reading or prints an error code if the OPEN was not successful.

FILENAME="c:\library\book1.txt"

UOPEN FILENAME FOR READ TO FILEDES ELSE

   PRINT "Unable to UOPEN ":FILENAME:"

      Code=":UERROR( )

   STOP

END

UREAD VAAR2 FROM FILEDES FOR 50 THEN

   LENGTH=LEN(VAR2)

   IF LENGTH=50 ELSE

      PRINT "Only able to read ":UERROR( ):" bytes."

   END

END ELSE

   PRINT "Unable to read ":FILENAME:"

      Code=":UERROR( )

END

UCLOSE FILEDES ELSE NULL

See Also

O/S Interoperability Commands

UCLOSE Command

UCREATE Command

UDELETE Command

UEXECUTE Command

ULOCK Command

ULSEEK Function

UMESSAGE Command

UOPEN Command

UREAD Command

UREADLINE Function

USYSTEM Function

UWAITFOR Command

UWRITE Command