You need to use (const char*)b
or c.c_str()
since sprintf()
(which is used for formatting) will not accept String
objects but only const char*
for the %s
place holder.
When stating something like this it's always also advisable to quote the actual compile error to see why it wouldn't.