-
'vararg' functions??
Hey All -
I want to send a string as a formated string to a function... meaning
say the function name is LOG
so i want to do a function call as
LOG("The integer valu is %d",iValue);
this string shd go as "The integer valu is 10", if iValue is 10....
i tried declaring the function as
void LOGGER(char *chpLog, ...) // (i tried to use the eclips operator)
{
-------
}
but the value of chpLog is comming as "The integer valu is %d"... do any one know how to tackle this ??
I know we can format the string using sprintf or CString::Format()..... but all these requires another variable and memory ...which i dont want to spend...!!
can it be solved using 'vararg' functions??... does any one know its implementation????
-
Re: 'vararg' functions??
your function declaration is correct, but you need to use vargs. see the example for vsprintf .
-
Re: 'vararg' functions??
super dude... its worked fine