Aperture Laboratories Aperture Laboratories - 1 year ago 98
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++.

Answer Source

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:

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download