Thanks for all the replies. It turns out that the short answer is "you can't". as in you can't wrap printf in another function. What you can do instead is wrap vprintf in a function because vprintf takes a va_list as a parameter. for the curious , the most direct answer to my question was found here: http://www.talkaboutprogramming.com/group/comp.lang.c/messages/738128.html int myprintf(char* fmt, ...){ int retval=0; va_list ap; va_start(ap, fmt); /* Initialize the va_list */ retval = vprintf(fmt, ap); /* Call vprintf */ va_end(ap); /* Cleanup the va_list */ return retval; }
And I managed to get it working before Monday noon. Thanks again for all the replies. I'll try to make the April monger meeting. Greg ________________________________ From: [EMAIL PROTECTED] on behalf of Greg London Sent: Sat 3/11/2006 11:04 AM To: [email protected] Subject: [Boston.pm] Off topic: C question Off topic. Please reply offlist to email at greglondon dot com Sorry, but I need to get this working by Monday morning, and I'm out of people to ask. I need to write a function in C that wraps printf, passing printf all the parameters that got passed into the wrapper. In perl, it would look something like this: sub wrapper { # preprocessing print ( @_ ); # post processing } I cannot figure out how to do this in C. I've talked to a couple of coworkers and none of them knew how to do it, but none of them would say definitely that it was impossible to do, they just didn't know how to do it. Please reply offlist to email at greglondon dot com I'll buy pizza for one of the next monger meetings. Greg _______________________________________________ Boston-pm mailing list [email protected] http://mail.pm.org/mailman/listinfo/boston-pm _______________________________________________ Boston-pm mailing list [email protected] http://mail.pm.org/mailman/listinfo/boston-pm

