Questions tagged [printf]

10 questions
2
votes
3 answers

formatting of IPAddress via printf(...) family similar to Serial Object

I am trying to use an sprintf with an IPAddress and I am not sure why Serial.print() is able to convert IPAddress to a reasonable human readable representation. I mean, presumably it uses an overloaded function that detects what type the parameter…
Octopus
  • 160
  • 2
  • 8
1
vote
1 answer

How to use a variable format in `sprintf`

How should I make a variable format sequence for sprintf?. 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…
Brethlosze
  • 337
  • 3
  • 17
0
votes
1 answer

printf %s gives gibberish

This Code: String S0 = ""; String S1 = "1"; String S2 = "12"; String S3 = "123"; String S4 = "1234"; String S5 = "12345"; String S6 = "123456"; String S7 = "1234567"; String S8 = "12345678"; String S9 = "123456789"; String S10 = "1234567890"; String…
AKTanara
  • 191
  • 6