my_printf calling printf

Mary Lu Wason mlw at taffy.bellcore.com
Fri Mar 1 03:07:27 AEST 1991


	You can try this:

	my_printf(debug,format,a,b,c,d,e,f,g,h,i,j,k)
	int debug;
	char *format;
	int a,b,c,d,e,f,g,h,i,j,k;
	{
	
		if(debug){
			fprintf(stderr,"MYDBG:");
			fprintf(stderr,format,a,b,c,d,e,f,g,h,i,j,k);
		}
	}

	
	This works on both Unisys and MVS. Yes, a - k can
	be longs and chars etc. printf uses the format 
	string to figure what they are. printf doesn't 
	look for any more arguments than are in the
	format string. 

	Of course, for this you have to take a guess as to
	how many arguments will be used.

		-Mary Lu



More information about the Comp.lang.c mailing list