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. Managed C++/CLI
  4. Hex addition with VC++ in WinXP

Hex addition with VC++ in WinXP

Scheduled Pinned Locked Moved Managed C++/CLI
helpc++tutorialquestion
3 Posts 2 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.
  • P Offline
    P Offline
    pkyiu
    wrote on last edited by
    #1

    Hello everybody, I am a newbie to C++ programming and I need to do some hex addition with VC++ and then output the result as ASCII. Here is my problem: hex1(5A 30 35 30 30) which is equal to decimal(387355848752), I want to add hex(100) to hex1 which is hex2(5A 30 35 31 30) equal to decimal(387355849008). This is exactly equal to adding 256 to the first decimal. I know unsigned int data type can only support 4294967295 which is still not enough for my case, and I would like to know how to convert these hex to ASCII with C++? Your help is very much appreciated, thank you.:)

    G 1 Reply Last reply
    0
    • P pkyiu

      Hello everybody, I am a newbie to C++ programming and I need to do some hex addition with VC++ and then output the result as ASCII. Here is my problem: hex1(5A 30 35 30 30) which is equal to decimal(387355848752), I want to add hex(100) to hex1 which is hex2(5A 30 35 31 30) equal to decimal(387355849008). This is exactly equal to adding 256 to the first decimal. I know unsigned int data type can only support 4294967295 which is still not enough for my case, and I would like to know how to convert these hex to ASCII with C++? Your help is very much appreciated, thank you.:)

      G Offline
      G Offline
      George L Jackson
      wrote on last edited by
      #2

      If this is a C++ question and not a C++/CLI question then you are in the wrong forum. long long h1 = 0x5A30353030LL; long long h2 = 0x100LL; _tprintf_s(_T("%I64X\n"), h1 + h2); -- modified at 13:03 Saturday 2nd December, 2006

      P 1 Reply Last reply
      0
      • G George L Jackson

        If this is a C++ question and not a C++/CLI question then you are in the wrong forum. long long h1 = 0x5A30353030LL; long long h2 = 0x100LL; _tprintf_s(_T("%I64X\n"), h1 + h2); -- modified at 13:03 Saturday 2nd December, 2006

        P Offline
        P Offline
        pkyiu
        wrote on last edited by
        #3

        Thank you very much! It works fine and I was in such hurry and I overlooked (Managed), and I should have posted on the VC++/MFC board? Sorry for my mistake.:) Besides, how can I convert the resulting hex to ASCII string? Is there a function _tprintf_s(_T("%s\n"), h1+h2); ? I tried but it does not work.:confused: -- modified at 13:35 Saturday 2nd December, 2006

        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