Optim Data Privacy Providers  11.7.0
 All Data Structures Files Functions Variables Macros Groups Pages

In the following example, the formatted error message is obtained for the errorcode.

void PrintErrorMessage(int errorcode)
{
ODPP_WCHAR ErrMsgSrc[ODPP_MAX_ERR_MSG_SRC_LENGTH + 1];
ODPP_WCHAR ErrMsgText[ODPP_MAX_ERR_MSG_TEXT_LENGTH + 1];
ODPP_WCHAR ErrMsgBody[ODPP_MAX_ERR_MSG_BODY_LENGTH + 1];
DP_ERR_MSG ErrMsg;
RETVAL retVal1 = 0;
memset(&ErrMsg, 0, sizeof(DP_ERR_MSG));
ErrMsg.cSubType = 'W';
//Allocate the buffers
ALLOC_TYPE(DPEM_WC_SS, ErrMsg.EM.pWC, 1)
if(NULL == ErrMsg.EM.pWC)
{
printf("\nMem Alloc failed for DPEM_WC_SS\n");
return;
}
memset(ErrMsg.EM.pWC, 0, sizeof(DPEM_WC_SS));
ErrMsg.EM.pWC->pMsgSrc = &ErrMsgSrc[0];
ErrMsg.EM.pWC->iMsgSrcBytes = sizeof(ErrMsgSrc);
ErrMsg.EM.pWC->pMsg = &ErrMsgText[0];
ErrMsg.EM.pWC->iMsgBytes = sizeof(ErrMsgText);
ErrMsg.EM.pWC->pMsgBody = &ErrMsgBody[0];
ErrMsg.EM.pWC->iMsgBodyBytes = sizeof(ErrMsgBody);
ErrMsg.iErrNum = errorcode;
retVal1 = Provider_GetFmtErrMsgEarly(&ErrMsg);
if(ODPPSUCCESS != retVal1)
{
printf("\nFunc Provider_GetFmtErrMsgEarly failed, rc = %d\n", retVal1);
goto OnError;
}
#ifdef _PRINTF_LS
printf("Error Message Source:%ls\n",ErrMsgSrc);
printf("Error Message Text: %ls \n",ErrMsgText);
printf("Error Message Body: \n %ls\n",ErrMsgBody);
#else
printf("Error Message Source:%ws\n",ErrMsgSrc);
printf("Error Message Text: %ws \n",ErrMsgText);
printf("Error Message Body: \n%ws\n",ErrMsgBody);
#endif
OnError:
free(ErrMsg.EM.pWC);
ErrMsg.EM.pWC = NULL;
return;
}