#define SEND_VALUE(num, point1, point2, point3...) \
{ \
char number[6]; \
char p1[6];\
char p2[6];\
char p3[6];\
if(num == ONE) {sprintf(number, "ONE");}\
if(num == TWO) {sprintf(number, "TWO");}\
if(num == THREE) {sprintf(number, "THREE");}\
if(point1 == ONE) {sprintf(p1, "ONE");}\
if(point1 == TWO) {sprintf(p1, "TWO");}\
if(point1 == THREE) {sprintf(p1, "THREE");}\
if(point2 == ONE) {sprintf(p2, "ONE");}\
if(point2 == TWO) {sprintf(p2, "TWO");}\
if(point2 == THREE) {sprintf(p2, "THREE");\
if(point3 == ONE) {sprintf(p3, "ONE");}\
if(point3 == TWO) {sprintf(p3, "TWO");}\
if(point3 == THREE) {sprintf(p3, "THREE");\
fprintf(fp,"%s:%s:%s:%s:\n",number, p1,p2,p3);\
fflush(fp); \
fprintf(fp,fmt,##__VA_ARGS__);\
fflush(fp); \
fprintf(fp,"\n");\
fflush(fp); \
}
As of now, this macro doesn't require to be variadic. But for future use, I want it to be variadic. I don't know how to write/define the argument list in the variadic macro and how to use them. As in the above eg, p1, p2 should be set and printed.
I am calling this macro like this:
SEND_VALUE(ONE, ONE, ONE, ONE);
Could someone please help in achieving this the variadic way?