Signals the error specified by the value in code to the Visual FoxPro run time.
|
---|
void _Error(int code)
int code; /* Internal Visual FoxPro
error number. */ |
Remarks
Example
The following example calls _Error( ) when _DBSkip( ) returns an error number. The Visual FoxPro code shows how to cause _Error( ) to be called.
Visual FoxPro Code
| Copy Code |
---|
SET LIBRARY TO ERROR
DO CreateTest
ON ERROR DO expectError
USE
= DBSKIP(1) && _Error() called: no DBF in use
USE test
GO TOP
= DBSKIP(-1)
= DBSKIP(-1) && _Error() called: at top of file
GO BOTT
= DBSKIP(1)
= DBSKIP(1) && _Error() called: at bottom of file
ON ERROR
PROCEDURE expectError
? "ERROR: " + MESSAGE()
RETURN
PROCEDURE CreateTest
CREATE TABLE test (ABC C(20))
APPEND BLANK
REPLACE ABC WITH "This is record 1"
APPEND BLANK
REPLACE ABC WITH "This is record 2"
APPEND BLANK
REPLACE ABC WITH "This is record 3"
APPEND BLANK
REPLACE ABC WITH "This is record 4"
GO TOP
RETURN |
C Code
| Copy Code |
---|
#include <pro_ext.h>
FAR Example(ParamBlk FAR *pblk)
{
int RetCode;
if ((RetCode = _DBSkip(-1, pblk->p[0].val.ev_long)) < 0) {
_PutStr("\nError encountered in example program.");
_Error(-RetCode); // _DBSkip() returns negative error code
}
_RetInt(RetCode, 10);
}
FoxInfo myFoxInfo[] = {
{"DBSKIP", (FPFI) Example, 1, "I"},
};
FoxTable _FoxTable = {
(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo
}; |
See Also