Is there is a way within C to trap stdout and prevent it from displaying.

In my example I call a function that has the potential to print an error message to stdout. Is there a way to prevent messages to stdout from being displayed while my program calls on a function(trapping anything going to stdout). I know I could just modify the parameters to it to decide whether to display the error message or not, but modifying those would cause numerous other modifications since many other programs call upon this function.
I'm also just curious if its possible.

Any thoughts, alternatives?