in reply to How to zero-pad hex values in sprintf()?
Also, please see sprintf for a comprehensive discussion of the formatting specifiers available.