Char* to DWORD
You could just cast the char pointer to a DWORD - the new data-type will of course not actually contain any of the data, but will just be a copy of the pointer:
I've done this with texture pointers and suchlike in my renderState system (D3D uses mostly DWORDs).
char *myChars = new char[128];DWORD nDword = (DWORD) myChars;
I've done this with texture pointers and suchlike in my renderState system (D3D uses mostly DWORDs).
Assuming C++, you can either use boost::lexical_cast or a std::stringstream.
std::stringstream sstr;sstr << my_dword;char * ptr1 = sstr.str().c_str();std::string str = boost::lexical_cast<std::string>(my_int);char * ptr2 = str.c_str();std::stringstream sstr;sstr.str(char_ptr);DWORD dword1;sstr >> dword1;DWORD dword2 = boost::lexical_cast<DWORD>(char_ptr);
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement