use sprintf() instead of printf()