put_logfunc

Sets a log routine.

void put_logfunc(lprec *lp, logfunc newlog, void *loghandle);

Return Value

put_logfunc has no return value.

Parameters

lp

Pointer to previously created lp model. See return value of make_lp, copy_lp, read_lp, read_lp_file, read_LP, read_mps, read_MPS

newabort

The log routine.
typedef void WINAPI logfunc(void *lp, void *userhandle, char *buf);
WINAPI is only applicable when lp_solve is compiled as windows dll.

loghandle

A parameter that will be provided to the log routine.

Remarks

The put_logfunc function sets a log routine.
When set, the log routine is called when lp_solve has someting to report (error conditions or so). The return value of this routine should be 0. The log routine can be cleared by specifying NULL as log routine.
The default is logging to the console (stdout).

Example

#include <stdio.h>
#include <stdlib.h>
#include "lpkit.h"

int logfunction(void *lp, void *userhandle, char *buf)
{

 /* do something with buf (the message) */

 return(0);
}

int main(void)
{
  lprec *lp;

  /* Create a new LP model */
  lp = make_lp(0, 0);
  if(lp == NULL) {
    fprintf(stderr, "Unable to create new LP model\n");
    return(1);
  }

  put_logfunc(lp, logfunction, NULL);
  set_verbose(lp, FULL);

  del_column(lp, 1); /* Will generate an error because column 1 does not exist */
                     /* Note that del_column returns FALSE (0) to indicate an error */
  delete_lp(lp);
  return(0);
}

lp_solve API reference

See Also make_lp, copy_lp, read_lp, read_lp_file, read_LP, read_mps, read_MPS, put_abortfunc