[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]
function with variable number of arguments !
I am facing one problem here related to getting traces
out of my code. The way traces have been implemented
in the code is that I have one hash define(
RUDRA_PRINT) defined in a header file as
#define RUDRA_PRINT printf.
In the code, this is something like this
Actually, the requirement is to use "lprintf"( someone
who is using my code has defined this) instead of
"printf" to get the traces. The only difference
between these are that lprintf has additional 1st
agrument which is some integer value signifying
TERMINAL_ID. Well, I am not able to figure put how to
define RUDRA_PRINT so that I get the traces.
All the attempts like
RUDRA_PRINT(X) lprint(value,X) are failing while
so what i did was i declared RUDRA_PRINT as
with prototype of new_print to be same as printf ( i.e
variable number of arguments )
So to correct this, I implemented ( obviously
following K&R) a simple printf function using
declarations in "stdarg.h" e.g. va_start, va_end etc.
so for this I had to include "stdarg.h".
Now, the problem is guy doesn't want, preferably, any
standard header files to be included in code. So I
can't use this.
Can u think of some alternative ?
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35
a year! http://personal.mail.yahoo.com/