I am writing code in C to print out various data values from some test I am running. The data results come in ints, long ints, floats and doubles.
Most data values are required to be in decimal, but certain data values only make sense if they are printed in hex. The values are all stored as decimal values, and then I just convert them to hex when I print them out:
printf("0x%x", myVal);
So, what if myVal is stored in my data file as a long decimal int.... Is there some way to specify a long hex integer, or should I just print out some error message instead and look into the issue further if it ever even happens?
If the long int case is usually handled:
printf("%ld", myVal);
Is the long hex int case then handled:
printf("%lh", myVal);
?