I have a format string like this:
buf[] = "A%d,B%d,C%d,D%d,F%d,G%d,H%d,I%d,J%d";
and I want to insert the same integer for each %d
so I use:
int val = 6;
sprintf(buf2, buf, val,val,val,val,val,val,val,val,val);
Can I use sprintf
in a way that only requires me to write val
once, and sprintf
will use it for each %d
?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…