preproccessor question November 04, 2010 05:52AM | Registered: 15 years ago Posts: 444 |
#define SENDVARIABLES(x,arg1,arg2,arg3,arg4,arg5,arg6) \ do{ \ if(arg1!=NOTAVAR) \ addVariableDouble(x*6,arg1,(char*)"Player 2 arg1 x");\ if(arg2!=NOTAVAR) \ addVariableDouble(x*6+1,arg2,(char*)"Player 2 arg2 x"); \ if(arg3!=NOTAVAR) \ addVariableDouble(x*6+2,arg3,(char*)"Player 2 arg3 x"); \ if(arg4!=NOTAVAR) \ addVariableDouble(x*6+3,arg4,(char*)"Player 2 arg4 x"); \ if(arg5!=NOTAVAR) \ addVariableDouble(x*6+4,arg5,(char*)"Player 2 arg5 x"); \ if(arg6!=NOTAVAR) \ addVariableDouble(x*6+5,arg6,(char*)"Player 2 arg6 x");\ } while(0)I am trying to get the value of x , and arg1-6 in the first two arguments of addVariableDouble, and in the last one I want the to be strings. When I run it now the first two arguments are fine, but the string turns out as "Player 2 arg1 x"
Re: preproccessor question November 04, 2010 10:01AM | Registered: 14 years ago Posts: 379 |
#define STRINGIFY(x) #x #define SENDVARIABLES(x,arg1,arg2,arg3,arg4,arg5,arg6) \ do{ \ if(arg1!=NOTAVAR) \ addVariableDouble(x*6,arg1,(char*)"Player 2 " STRINGIFY(arg1) " " STRINGIFY(x));\ ...
Re: preproccessor question November 04, 2010 02:31PM | Registered: 15 years ago Posts: 444 |
Re: preproccessor question November 04, 2010 04:34PM | Registered: 14 years ago Posts: 379 |
Re: preproccessor question November 05, 2010 06:14AM | Registered: 15 years ago Posts: 444 |