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