I'm trying to get fprintf function working only when DEBUG is defined. This worked ok for printf, but it seems I can't get the right prototype for fprintf function.
I get compiler error: "Attempt to create a pointer to a constant"
Is there any better way to do it? I would like to have debug_printf function that I can use as a standard printf. For example:
Code:
void debug_printf(char *format, ...){
#IFDEF DEBUG
fprintf(RS232_DEBUG, ........); // I'm not sure how to pass all parameters to fprintf function
#ENDIF
}
Mike Walne
Joined: 19 Feb 2004 Posts: 1785 Location: Boston Spa UK
Thank you Mike for the link. For now, gribas proposed best solution with #define trace... I was hoping for a little bit more elegant solution, but this will do.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum