Rockwell Automation 1747-PCINT API Software for 1746 I/O User Manual
Page 37

Developing Applications
3–11
Publication 1747-6.5.3 Junel 1998
/************************************************************************
*
*
Name: Ioexit
*
*
Description:
*
*
Common error handling routine. This routine displays any
*
extended error and exits the program.
*
*
Arguments:
*
retcode : int( input )
*
This error code is passed to the exit() routine.
*
*
External effects:
*
The program is terminated.
*
*
Return value:
*
none
*
************************************************************************/
void Ioexit( int retcode )
{
OCEXTERR exterr;
char *msg;
if (OC_GetExtendedError(Handle, &exterr) == SUCCESS)
{
if ( exterr.ErrorCode != 0 )
{
OC_ExtendedErrorMsg(Handle, &exterr, &msg);
printf(”\nERROR: %s\n”, msg);
}
}
OC_CloseScanner(Handle);
exit(retcode);
}
/* end Ioexit() */