Reputation: 161
I'm currently using C Builder:
DWORD finalAddress = 0xFFFFFFFF; TListItem *ListIt; ListIt->Caption = finalAddress;
This will output: 4294967295 (which is 0xFFFFFFFF in DEC)
I want it to show 0xFFFFFFFF.
How do I do that?
Upvotes: 3
Views: 8287
Reputation: 727047
Assuming that you have access to C++ standard library, try this:
#include <sstream>
#include <iostream>
#include <string>
std::ostringstream ss;
ss << std::hex << finalAddress;
AnsiString ansiHex = AnsiString (ss.str().c_str());
ListIt->Caption = ansiHex;
This last assignment may not work - I do not have access to Embarcadero's headers, so I have no idea what's the type of ListIt->Caption
. There may be need to perform additional conversion.
Upvotes: 2