While using sprintf like this
sprintf("%.40s",str);
I want to give a value like strlen(str) in place of 40.How do I do that? I tried replacing 40 with strlen(str), doesn't work. giving a value like
#define len strlen(str)
and using %.len doesnt work either since %.len is in "".