Aperture Laboratories Aperture Laboratories - 9 months ago 58
C++ Question

How to suppress output of LibSVM in C++ [library mode]

When LibSVM is executed from command line, i can give -q as a parameter and all will be ok. But, when i use it as a library, there is no -q parameter to set programmatically. How can i suppress the output then? There exist solutions in Java and python, but not in C++.


You can use the same trick that they do in svm_train.c.

  • First define a function that does nothing:

    void print_null(const char *s) {}
  • Then call the function that sets the printing: