CPXXdelfuncdest and CPXdelfuncdest

The routine CPXXdelfuncdest/CPXdelfuncdest removes the function msgfunction from the list of message destinations associated with a channel.

int  CPXXdelfuncdest( CPXCENVptr env, CPXCHANNELptr channel, void * handle, void(CPXPUBLIC *msgfunction)(void *, const char *) )

int  CPXdelfuncdest( CPXCENVptr env, CPXCHANNELptr channel, void * handle, void(CPXPUBLIC *msgfunction)(void *, const char *) )

Description

The routine CPXXdelfuncdest/CPXdelfuncdest removes the function msgfunction from the list of message destinations associated with a channel. Use CPXXdelfuncdest/CPXdelfuncdest to remove functions that were added to the list using CPXXaddfuncdest/CPXaddfuncdest.

To illustrate, consider an application in which a developer wishes to trap CPLEX error messages and display them in a dialog box that prompts the user for an action. Use CPXXaddfuncdest/CPXaddfuncdest to add the address of a function to the list of message destinations associated with the cpxerror channel. Then write the msgfunction routine. It must contain the code that controls the dialog box. When CPXXmsgstr/CPXmsgstr is called with cpxerror as its first argument, it calls the msgfunction routine, which then displays the error message.

Note: The handle argument is a generic pointer that can be used to hold information needed by the msgfunction routine to avoid making such information global to all routines.

Arguments

env

A pointer to the CPLEX environment as returned by CPXXopenCPLEX/CPXopenCPLEX.

channel

The pointer to the channel from which the function destination is to be deleted.

handle

A pointer used in the msgfunction routine.

msgfunction

The pointer to the function that was to be called when a message was sent to the channel. For details about this callback function, see CPXXaddfuncdest/CPXaddfuncdest.

Return

The routines return zero if successful and nonzero if an error occurs. Failure occurs when msgfunction is not in the message-destination list or the channel does not exist.

Example


void CPXPUBLIC msgfunction (void *handle, const char *msg_string)
{
FILE *fp;
fp = (FILE *)handle;
fprintf (fp, "%s", msg_string);
}
status = CPXdelfuncdest (env, mychannel, fileptr, msgfunction);