![]() p4SetOutputFunction() |
![]() DEVELOPER |
![]() |
p4SetOutputFunction()
Register Report Output Function
Report Output
Introduction
The P4API p4SetOutputFunction() function is used to specify the name of a function to call whenever report output is received. The caller must supply this function.
BOOL p4SetOutputFunction(
SESSION_HANDLE_T kernelSessionHandle,
PREPORT_OUTPUT_FUNCTION pProcessReportOutputData
);
Parameters
KernelSessionHandle
[in] The kernel-session-id for a PROIV Virtual Machine session, as returned by a prior call to p4OpenPro4().
pProcessReportOutputData
[in] A pointer to the function to call to process report output. Specifying NULL disables any currently defined output function for this session.
Return Values
TRUE if OK.
Remarks
This function allows the caller to process report output. The function must be defined with a compatible parameter list to the expected one. For example:
int processReportOutputData(SESSION_HANDLE_T sessionHandle,
int nOutputFormat, int nType, int nLineCtrl,
int nDataLen, const char *pObuf);
&
if (!p4SetOutputFunction (sessionHandle, processReportOutputData)) {
fprintf(stderr, "p4SetOutputFunction failed, error %d\n",
p4GetLastError());
stat = -1;
}
See the definition of processReportOutputData() below for an example of the function, with details of what report data is returned. If no report processing function is supplied, the P4API interface will echo any received output to stdout (the standard output device).
Topic ID: 540193