PaulS:
This is the safest
How? That won't even compile. sprintf and snprintf are different functions.
It should have read snprintf in the code. well spotted, changed.
And safest because snprintf will never write past the end of the string (as long as you set the limiting number right).