P
Praveen.Kumar.SP
Hi
Could anyone solve the problem for the code below
The Code:
#include "stdio.h"
#include "iostream.h"
void Temp( int a, char* str,...)
{
//code to handle the arguments
}
#define MYPRINT(_x_) printf _x_
#define MYPRINT1(_x_) Temp( 10,_x_)
int main()
{
MYPRINT(("This is a test for multiple argument %s
%d",__FILE__,__LINE__));
MYPRINT1(("This is a test for multiple argument %s
%d",__FILE__,__LINE__));
return 0;
}
Problem:
In the first macro I am able to get the result as expected from the
printf where as in the second case my parameters are not properly
passed to the function Temp. Could anyone of you tell me why i am not
abel to use the macro to pass parameter to a function with some
mandatory number of parameter and variable number of parameter?
Is there any way that i can paa the parameter as i expected?how?
Thanks
praveen
Could anyone solve the problem for the code below
The Code:
#include "stdio.h"
#include "iostream.h"
void Temp( int a, char* str,...)
{
//code to handle the arguments
}
#define MYPRINT(_x_) printf _x_
#define MYPRINT1(_x_) Temp( 10,_x_)
int main()
{
MYPRINT(("This is a test for multiple argument %s
%d",__FILE__,__LINE__));
MYPRINT1(("This is a test for multiple argument %s
%d",__FILE__,__LINE__));
return 0;
}
Problem:
In the first macro I am able to get the result as expected from the
printf where as in the second case my parameters are not properly
passed to the function Temp. Could anyone of you tell me why i am not
abel to use the macro to pass parameter to a function with some
mandatory number of parameter and variable number of parameter?
Is there any way that i can paa the parameter as i expected?how?
Thanks
praveen