Hi All,
Please let me know how variable argument functions can be dynamically churned
and the va_start , va_arg , va_end functions be used for the same.
Generally the va_ functions are used when the variable list of arguments are
expected to a function like say
int test_routine(char *s, const char *format, ...)
now I could have calls like the below and all of them would be handled by the
above definition .
All the below calls are hard coded and calls are made .
test_routine("Hello" , "Test", 1 , 100 , "Mark");
test_routine("Hello" , "Test", 1 "Twain");
test_routine("Hello" , "Test", 1 , 100 );
But I have a requirement where in I receive the number of arguments at random
at run time in a char array . How do I churn out code that does the same thing
i.e. call test_routine with the dynamic list of variable arguments.
I would dynamically need to make one of the
test_routine("Hello" , "Test", 1 , 100 , "Mark");
test_routine("Hello" , "Test", 1 "Twain");
test_routine("Hello" , "Test", 1 , 100 );
below calls based on program logic. How can this be achieved ? Request your
inputs in this regard.
Regards,
Kiran
**************** CAUTION - Disclaimer *****************
This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely
for the use of the addressee(s). If you are not the intended recipient, please
notify the sender by e-mail and delete the original message. Further, you are
not to copy, disclose, or distribute this e-mail or its contents to any other
person and any such actions are unlawful. This e-mail may contain viruses.
Infosys has taken every reasonable precaution to minimize this risk, but is not
liable for any damage you may sustain as a result of any virus in this e-mail.
You should carry out your own virus checks before opening the e-mail or
attachment. Infosys reserves the right to monitor and review the content of all
messages sent to or from this e-mail address. Messages sent to or from this
e-mail address may be stored on the Infosys e-mail system.
***INFOSYS******** End of Disclaimer ********INFOSYS***
[Non-text portions of this message have been removed]