I have a macro as such
#define PTF(A,y) fprintf(file,"%s",A,y);printf("%s %d",A,y);
so that it will print to file and console
so for example i call this macro function
int y=9;
PTF("\nRound %d \n",y);
in a way I need the y=9 to be shown as part of the argument A so my fprintf in file will look like below
Round 9
because I have a lot of changes to make if I were to change this, hence hoping for an easy way out =)
Change
#define PTF(A,y) fprintf(file,"%s",A,y);printf("%s %d",A,y);to
#define PTF(A,y) fprintf(file,A,y);printf("%s %d",A,y);Note:
PTF("Round %d",9);will have fprint writeRound 9to the file but printf will still showRound %d 9.You’ll also have to make sure you only specify one specifier to fprintf