Is it possible to make the execution of a program skip fprintf-statements/How to create my own fprintf-function?
<p>In my C++-code there are several fprintf-statements, which I have used for debugging. Since I might need them again, I would prefer not to comment them out for the moment.
However, I need the execution of the program to be fast, so I would like to avoid them being printed out, as they are for the moment (I redirected stderr to a file).</p>

<p>Preferably this would be determined by the user passing an argument to the program, which I would extract like this:</p>

<pre><code>main (int argc, char *argv[])
{
int isPrint=0;
if (argc &gt; 1 ) {
       isPrint = atoi ( argv[2]);
}

}
</code></pre>

<p>I thought of renaming fprintf to another name, and then from that function do a fprintf-call using the same parameters, based on the value of <strong>isPrint</strong>; however, then I realized that fprintf can have so many different kind of arguments and a various number of arguments; and that I don't know any generic way of declaring my own function with those requirements.</p>

<p>So I wonder how to create a function,which works exactly like fprintf, but which takes the extra parameter <strong>isPrint</strong>; or how to solve the above problem in another way.</p>

<p>Complementary information after first post:
One solution would be to add this before each fprintf-statement:</p>

<pre><code>if (isPrint == true )
</code></pre>
