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 the uerror() function. If the command is successful, the error code is zero.

The uerror() function reports return status codes resulting from the last mvBASIC inter-operating system statement. Exceptions are the uexecute command, uwaitfor command, and the umessage command.

Example(s)

The following example opens the \library\book1.txt file 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