Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Hex String to Decimal long

Hex String to Decimal long

Scheduled Pinned Locked Moved C / C++ / MFC
question
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    soup
    wrote on last edited by
    #1

    Hi, This must be really simple, but I am struggling with this. If I have a string such as: TCHAR hex[] = "0AF79E00"; How can I convert this into a long variable so I know it means: 184,000,000 Is this possible? :confused: Thanks in advance, Simon

    M C S 3 Replies Last reply
    0
    • S soup

      Hi, This must be really simple, but I am struggling with this. If I have a string such as: TCHAR hex[] = "0AF79E00"; How can I convert this into a long variable so I know it means: 184,000,000 Is this possible? :confused: Thanks in advance, Simon

      M Offline
      M Offline
      Mazdak
      wrote on last edited by
      #2

      There are some articles in CP about it. Check this and this Mazy "So,so you think you can tell, Heaven from Hell, Blue skies from pain,... How I wish,how I wish you were here."
      Wish You Were Here-Pink Floyd-1975

      1 Reply Last reply
      0
      • S soup

        Hi, This must be really simple, but I am struggling with this. If I have a string such as: TCHAR hex[] = "0AF79E00"; How can I convert this into a long variable so I know it means: 184,000,000 Is this possible? :confused: Thanks in advance, Simon

        C Offline
        C Offline
        Chris Hafey
        wrote on last edited by
        #3

        use sscanf: TCHAR hex[] = "0x0AF79E00"; int value; sscanf(hex, "%X", &value); Chris Hafey

        1 Reply Last reply
        0
        • S soup

          Hi, This must be really simple, but I am struggling with this. If I have a string such as: TCHAR hex[] = "0AF79E00"; How can I convert this into a long variable so I know it means: 184,000,000 Is this possible? :confused: Thanks in advance, Simon

          S Offline
          S Offline
          soup
          wrote on last edited by
          #4

          Cheers for the help guys. :) I'm now back on track. :cool: Simon

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups