Problems when using long long

My guess is that the sprintf is not handling the 64-bt datatype. %ld means long not long long.

To print, I see you have 2 options:

  1. write your own routine to print the long long value
  2. convert to double and print using sprintf
  3. print out in hex, first the upper 32-bits, then the lower 32.

I hope that helps.