CPXXmsg and CPXmsg

The routine CPXXmsg/CPXmsg is deprecated in CPLEX V12.9.0. Instead, use CPXXmsgstr/CPXmsgstr. For a simple way of transitioning, see the steel.c example code.

int  CPXXmsg( CPXCHANNELptr channel, char const * format, ...  )

int  CPXmsg( CPXCHANNELptr channel, char const * format, ...  )

Description

The routine CPXXmsg/CPXmsg writes a message to a specified channel. Like the C function printf, it takes a variable number of arguments comprising the message to be written. The list of variables specified after the format string should be at least as long as the number of format codes in the format. The format string and the variables must be of the same format as the arguments of printf. If the value of a variable corresponding to a "%s" term in the format is NULL then the behavior of CPXXmsg/CPXmsg is undefined.

NOTE: The routine CPXXmsg/CPXmsg is deprecated in CPLEX V12.9.0. Instead, use CPXXmsgstr/CPXmsgstr. For a simple way of transitioning, see the steel.c example code.

The formatted string is limited to CPXMESSAGEBUFSIZE characters (including the terminating NUL character), and is usually output by the C function fputs to each output destination in the output destination list for a channel, except when a function has been specified by the routine CPXXaddfuncdest/CPXaddfuncdest as a destination. If the length of the formatted string (including the terminating NUL character) exceeds CPXMESSAGEBUFSIZE then the behavior of this function is unpredictable.

The CPLEX Callable Library uses CPXXmsg/CPXmsg for all message output. The routine CPXXmsg/CPXmsg may also be used in applications to send messages to either CPLEX-defined or user-defined channels.

Note: CPXXmsg/CPXmsg is the only nonadvanced CPLEX routine not requiring the CPLEX environment as an argument.

Encoding

The encoding used for each destination is specific to that destination: for a function destination the encoding for the callback is the value of the parameter CPXPARAM_Read_APIEncoding that was active at the time when the routine CPXXaddfuncdest/CPXaddfuncdest was called for it.

Arguments

channel
The pointer to the channel receiving the message.
format
The format string controlling the message output. This string is used in a way identical to the format string in a printf statement in a C application.
...
The list of variables to be printed in the message.

Return

At completion, CPXXmsg/CPXmsg returns the number of characters in the formatted result string.

Example


      CPXmsg (mychannel, "The objective value was %f.\n", objval);
      

For a sample of this routine in use, see lpex5.c among the examples distributed with the product.