[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
R_LastErr()
Retrieves the last occurred error code (v2.0)
------------------------------------------------------------------------------
Syntax
nErrCode := R_LastErr ()
Parameters
(None)
Returns
nErrCode Last occurred error code
The values and descriptions of this return code
are defined in RCmpLib.CH :
+-----------------------------------------------------------+
|Code|Constant |Description |
|----+--------------------+---------------------------------|
| 0 |CP_OKAY |Everything okay |
| 1 |CP_INVALID_PARM |Invalid parameter(s) passed |
| 2 |CP_OPEN_INPUT |Error OPENING input file |
| 3 |CP_NOT_RCMPLIB |Not compressed by RCmpLib |
| 4 |CP_WRONG_VERSION |Wrong version of RCmpLib |
| 5 |CP_CREATE_OUTPUT |Error CREATING output file |
| 6 |CP_READ_INPUT |Error READING input file |
| 7 |CP_WRITE_OUTPUT |Error WRITING output file |
| 8 |CP_CLOSE_INPUT |Error CLOSING input file |
| 9 |CP_CLOSE_OUTPUT |Error CLOSING output file |
| 10 |CP_MEMORY_ERROR |Not enough memory |
| 11 |CP_ALLOCATE_ERROR |Error allocating buffer |
+-----------------------------------------------------------+
Description
This function can be used in combination with one of the following
functions :
R_CPName(), R_CPSize() or R_IsRCmp().
After calling one of these functions you can use R_LastErr() to
determine which error did occur.
(The error code is not returned by these functions).
Example
#include "RCmpLib.CH"
LOCAL aCmpError := CP_ERRMSG && Array with messages
LOCAL cOrgName
LOCAL nOrgSize
cOrgName := R_CPName ( 'INVOICE.#BF' )
IF cOrgName = NIL
*-- Determine & display error
?'Error: ' + aCmpError [R_LastErr()]
ELSE
?'The original name is ', cOrgName
ENDIF
cOrgSize := R_CPSize ( 'INVOICE.#BF' )
IF cOrgSize < 0
*-- Determine & display error
?'Error: ' + aCmpError [R_LastErr()]
ELSE
?'The original size is ', nOrgSize, ' bytes.'
ENDIF
IF !R_IsRCmp ( 'INVOICE.#BF' )
*-- Determine & display error
?'Error: ' + aCmpError [R_LastErr()]
ELSE
?'File is compressed by RCmpLib !'
ENDIF
See Also:
R_CPName()
R_CPSize()
R_IsRCmp()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson