Is there such a thing as a Hexadecimal Long Int?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • KioKrofov
    New Member
    • Jun 2008
    • 7

    Is there such a thing as a Hexadecimal Long Int?

    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);
    ?
  • boxfish
    Recognized Expert Contributor
    • Mar 2008
    • 469

    #2
    I know absolutely nothing about printf, but I googled it. Here's the reference page I found. Is printf("%lx", longHexVar); what you're looking for?

    Comment

    • KioKrofov
      New Member
      • Jun 2008
      • 7

      #3
      excellent! thanks so much

      Comment

      Working...