ostringstream oss;
oss << static_cast<void *>(pointer);
CString s(oss.str().c_str());
... or ...
s = oss.str().c_str()
The only remaining question is whether you use Unicode strings or not.
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
Have a better answer? Share it in a comment.
From novice to tech pro — start learning today.
Open in new window
For dialog, you may want to use <sstream> instead:Open in new window
Here displayed also via cout; however, oss.str() is the string representation of the pointer value. For Windows dialog, you probly need the C-string. Then use oss.str().c_str().For displaying integer values in hex, include the standard header iomanip that gives you the hex manipulator, setfill('0'), and setw(8). Using them for any stream, the next integer will be displayed in hex representation using 8 characters, left padded by zeros:
Open in new window