CPXXsetlogfilename and CPXsetlogfilename
Sets and opens the log file.
int CPXXsetlogfilename( CPXCENVptr env, char const * filename, char const * mode )
int CPXsetlogfilename( CPXCENVptr env, char const * filename, char const * mode )
Description
This routine sets the CPLEX log file to the file specified by filename.
The CPLEX log file captures output from all four CPLEX-defined channels.
CPLEX opens the log file in the mode specified by mode,
which is a string following the same specification as the respective
argument for the function fopen in the C library.
CPLEX closes any previously open log file, even if opening a new
log file fails. Passing NULL as filename
is allowed and closes the current log file (if any).
CPXXsetlogfilename/CPXsetlogfilename
is equivalent to directing output from the
cpxresults,
cpxwarning,
cpxerror, and
cpxlog
message channels to a single file.
Arguments
- env
-
A pointer to the CPLEX environment as returned by
CPXXopenCPLEX/CPXopenCPLEX. - filename
- The name of the log file to open. CPLEX considers this argument a null-terminated string and passes it to the operating system as is, regardless of the encoding specified by the CPLEX API string encoding switch. The encoding that CPLEX uses when writing to the logfile is the value of file encoding switch at the time the log file is opened (that is, when this routine is called).
- mode
-
The mode in which CPLEX should open the file. The specification is
the same as that for the C library function
fopen. For example, use a quoted character, such as "w" to write or "a" to append. Make sure you open the file for writing; otherwise, CPLEX writes nothing to the log file, and CPLEX can produce an error every time it attempts to write. IffilenameisNULL, then this argument is ignored and can beNULL, too.
Return
The routine returns 0 (zero) if successful and nonzero if an error occurs.Example
status = CPXsetlogfilename (env, "logfile.txt", "w");