Re: How to show a string with hexadecimal integer included?

Discussion in 'C Programming' started by bd, Jun 26, 2003.

  1. bd

    bd Guest

    On Wed, 25 Jun 2003 23:50:11 +0000, Christopher Culver wrote:

    > I have a string which should include a hexadecimal number. I've tried %x
    > like this:
    >
    > printf("This is a hex number: %x", hexNumber)
    >
    > but this results in only the minimum number of digits being displayed,
    > i.e. "7e" instead of "0x007e". Is there anything I can use in place of %x
    > which will display the fully qualified hexadecimal number?
    >
    > Christopher Culver


    0x%04x is probably what you want.

    --
    Freenet distribution not available
    BOFH Excuse #95:

    Pentium FDIV bug
    bd, Jun 26, 2003
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Derk Gwen
    Replies:
    3
    Views:
    1,306
    Zoran Cutura
    Jun 26, 2003
  2. Martin Ambuhl
    Replies:
    1
    Views:
    824
    Dan Pop
    Jun 26, 2003
  3. Replies:
    15
    Views:
    11,939
    Eric Sosman
    Jun 23, 2006
  4. tobleron
    Replies:
    9
    Views:
    12,700
    Martin Gregorie
    Oct 27, 2008
  5. Randy Kramer
    Replies:
    12
    Views:
    368
    Robert Klemme
    Oct 25, 2007
Loading...

Share This Page