Avatar of Gene Klamerus
Gene Klamerus
Flag for United States of America

asked on 

zero padding the output of a long long int (in hex) in C++

I'm doing some data processing of a large data set in a small C++ app.

As part of this I need to print out (in hex) some long long integer values including leading zeros so that it displays as a full 16 characters of hex (ala 09002724800028be).

I can't quite figure out how to do this with a printf.  I'm able to get output with:
   printf("%llx", parent_ids[num_parent_ids]);
But that isn't zero padding at the front-end.  The above value would come out starting with 9.

How can I zero pad output (in hex) of a long long?
C++

Avatar of undefined
Last Comment
Gene Klamerus

8/22/2022 - Mon