Compartir a través de


_ErrorInfo( ) API Library Routine

Returns the external error number that corresponds to the Visual FoxPro internal error number specified by code.

int _ErrorInfo(int code, char FAR *message)
int code;                     /* Internal Visual FoxPro error number. */
char FAR *message;         /* Pointer to space for an error message. */

Remarks

The message parameter is a pointer to a character string that is the Visual FoxPro error message. If message isn't a null pointer, Visual FoxPro fills in the error message text associated with the external error number.

For more information on how to create an API library and integrate it with Visual FoxPro, see Accessing the Visual FoxPro API.

Example

The following example shows the information returned by _ErrorInfo( ).

Visual FoxPro Code

SET LIBRARY TO ERRORINF
= ERRORINFO(0)
= ERRORINFO(1)

C Code

#include <pro_ext.h>

void putLong(long n)
{
   Value val;

   val.ev_type = 'I';
   val.ev_long = n;
   val.ev_width = 10;

   _PutValue(&val);
}

void FAR ErrorInfo(ParamBlk FAR *parm)
{
   int ext;
   char FAR *message;

   if ((message =_Alloca(128)) == 0)
   {
      _Error(182); // "Insufficient memory"
   }
   ext = _ErrorInfo((int) parm->p[0].val.ev_long, message);

   _PutChr('\n'); putLong(ext); _PutStr(" "); _PutStr(message);
}

FoxInfo myFoxInfo[] = {
   {"ERRORINFO", (FPFI) ErrorInfo, 1, "I"},
};
FoxTable _FoxTable = {
   (FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo
};

See Also

_Error( ) API Library Routine | _UserError( ) API Library Routine | Accessing the Visual FoxPro API