Following you can find a very practical trick that allows you to enable/disable all prints to the screen with as little effort as possible while not dramatically increasing the overall code size to do this.
For C: Place on the top of your code or on a header file the following:
The following function accepts the address of a char * buffer, the formatting string for printf along with all the parameters needed to fill the formatting string and updates the location of the buffer to point at the final formatted string. [download id="2418"] This code does not require the user…
The following set of code present a fully functioning example of using a simple C library as part of a CPP based project to print on screen. [download id="2434"] The trick relies on encapsulating the C header definitions in the extern "C" declaration. extern "C" will make all function and…
The following set of code present a fully functioning example of using a simple CPP library as part of a C based project to print on screen. [download id="2428"] The trick relies on encapsulating the CPP header definitions in the extern "C" declaration. extern "C" will make all function and…