I have a simple program :
#include int main() { long i = 16843009; printf (\"%02x \\n\" ,i); }
I am using
%02x means print at least 2 digits, prepend it with 0's if there's less. In your case it's 7 digits, so you get no extra 0 in front.
%02x
0
Also, %x is for int, but you have a long. Try %08lx instead.
%x
%08lx