# put_logfunc Sets a log routine. void put_logfunc(lprec *lp, lphandlestr_func 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, read_mps, read_freemps, read_MPS, read_freeMPS, read_XLI newlog The log routine. typedef void (__WINAPI lphandlestr_func)(lprec *lp, void *userhandle, char *buf); Note the __WINAPI attribute. This is important under Windows. It ensures __stdcall calling convention which is required. 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. The return value of this routine should be 0. The log routine can be cleared by specifying NULL as log routine. This function is called at the same time as something is written to file set via set_outputstream, set_outputfile. Example
    #include <stdio.h>
    #include <stdlib.h>
    #include "lp_lib.h"

    void __WINAPI logfunction(lprec *lp, void *userhandle, char *buf)
    {

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

    }

    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, read_mps, read_freemps, read_MPS, read_freeMPS, read_XLI, put_abortfunc