#include <stdio.h> void main (void) { int i = 0xA12; char buf[20]; sprintf (buf, "%#010x", i); /* buf will contain the string "0x00000a12" }