How should I make a variable format sequence for [sprintf][1]?.

 int i=2,d=9;
 String sf;
 sprintf(sf,"%%0%d",i);
 fprintf(sf,d); 

While expecting the output.

 09

The compilation fails, with several errors, according the failing change I apply.

 Invalid cast from type 'String' to type 'char*'


 [1]: http://www.nongnu.org/avr-libc/user-manual/group__avr__stdio.html#ga6017094d9fd800fa02600d35399f2a2a