Listbox mit Werten füllen und in ein schönes Format bringen
-
Hallo,
ich habe ein Array mit Byte-Daten die ich gerne im Hexcode und im Ascicode anzeigen lassen will.
Bisher kann ich nur entweder oder und es schreibt mir alles in eine Spalte.for(i=0;i<=arraySize;i++) { // sprintf(str, "%02x", datenFeld[i]); str.Format("%02c",datenFeld[i]); m_Listbox.AddString(str); }Wie heißen denn die Befehle um es z.B. so hinzubekommen:
00 00 59 4C 4A 47 58 4F Y L J G Y O 49 40 45 58 58 4F 00 00 I M E X X OIrgendwie was mit m_Listbox.SetItemText(... , oder?
Vielen Dank für eure Hilfe!
Gruß gabele
-
Mach doch sowas wie:
hex.Empty(); txt.Empty(); for (i=0; i < arraySize; ++i) { temp.Format("%02X ", datenFeld[i]); hex += temp; temp.Format("%c ", datenFeld[i]); txt += temp; } m_Listbox.AddString(hex + txt);Für die Character-Darstellung musst Du allerdings ggfs. noch eine Sonderbehandlung für nicht darstellbare Zeichen einfügen
-
Danke Jencas, hab es jetzt hinbekommen.
Hab aber noch ein bischen was dran verändert:
CString hex; CString txt; CString temp; CString add; for(j=0;j<=(arraySize/16);j++) { for(i;i<=rowCount;i++) { add.Format("%08X H:", adressen); adressen+=16; temp.Format("%02x ", datenFeld[i]); hex += temp; temp.Format("%C ", datenFeld[i]); txt += temp; if(i==rowCount) { add += " "; hex += " "; } } m_list1.AddString(add + hex + txt); hex=""; txt=""; rowCount+=16; }Also nochmals vielen Dank!!!