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. Display Hexadecimal

Display Hexadecimal

Scheduled Pinned Locked Moved C / C++ / MFC
data-structureshelpquestion
3 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.
  • R Offline
    R Offline
    Rsh
    wrote on last edited by
    #1

    i have an unsigned char array which has certain data. I want that data of the array to be displayed in hexadecimal format in CListCtrl. For ex. if i have ch[0]=0x10,it should be displayed as 10 in the list control. can anybody help? Here is my code, but it displays l in the list control. ****************************** unsigned char DataMsg[32]; LV_ITEM lvitem; CString dataText= (CString)DataMsg[0]; lvitem.mask = LVIF_TEXT | 0; lvitem.iItem = iItem; lvitem.iSubItem = 0; pStrTemp1= dataText.GetBuffer(dataText.GetLength()); lvitem.pszText = pStrTemp1; m_listCntrl.InsertItem(&lvitem); *********************************** Rsh

    C T 2 Replies Last reply
    0
    • R Rsh

      i have an unsigned char array which has certain data. I want that data of the array to be displayed in hexadecimal format in CListCtrl. For ex. if i have ch[0]=0x10,it should be displayed as 10 in the list control. can anybody help? Here is my code, but it displays l in the list control. ****************************** unsigned char DataMsg[32]; LV_ITEM lvitem; CString dataText= (CString)DataMsg[0]; lvitem.mask = LVIF_TEXT | 0; lvitem.iItem = iItem; lvitem.iSubItem = 0; pStrTemp1= dataText.GetBuffer(dataText.GetLength()); lvitem.pszText = pStrTemp1; m_listCntrl.InsertItem(&lvitem); *********************************** Rsh

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      You could use an ostringstream and I think the modifier is hex() to make it display as hex. Christian We're just observing the seasonal migration from VB to VC. Most of these birds will be killed by predators or will die of hunger. Only the best will survive - Tomasz Sowinski 29-07-2002 ( on the number of newbie posters in the VC forum ) Cats, and most other animals apart from mad cows can write fully functional vb code. - Simon Walton - 6-Aug-2002

      1 Reply Last reply
      0
      • R Rsh

        i have an unsigned char array which has certain data. I want that data of the array to be displayed in hexadecimal format in CListCtrl. For ex. if i have ch[0]=0x10,it should be displayed as 10 in the list control. can anybody help? Here is my code, but it displays l in the list control. ****************************** unsigned char DataMsg[32]; LV_ITEM lvitem; CString dataText= (CString)DataMsg[0]; lvitem.mask = LVIF_TEXT | 0; lvitem.iItem = iItem; lvitem.iSubItem = 0; pStrTemp1= dataText.GetBuffer(dataText.GetLength()); lvitem.pszText = pStrTemp1; m_listCntrl.InsertItem(&lvitem); *********************************** Rsh

        T Offline
        T Offline
        Tomasz Sowinski
        wrote on last edited by
        #3

        Use CString::Format with %x or %X Tomasz Sowinski -- http://www.shooltz.com

        Never argue with an idiot, he'll bring you to his level and beat you with experience.

        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