Monday, 15 April 2013

c++ - How to convert int to LPBYTE -


I need to convert the int value to LPBYTE. When I look at the definitions, it is shown in this way. I'm not sure what the away is the word

  typedef unsigned four bytes; TPF Bit Away * LPBYT;        Edit   
  foo (LPBETE x) {} int main () {int y = koo (); Foo (y); // How to insert here 0; }  

Actual code

  int iVal = 0; Long res = RegQueryValueEx (HKE, L "Use System Separators", Faucet, and LPT, (LPBYTE) iVal, and Size);  

If I understand you correctly, then you find the variable address , and then convert that address to LPBYTE .

Then you will see the variable address operator & amp; must use an indicator in the variable, and insert that pointer:

  foo (reinterpret_cast  (& amp; y));  

If there is actually a known fact, then you have to be careful first because it is not guaranteed that int can be A memory address (i.e. one indicator). For example, consider 64-bit systems where the indicators are 64 bits, but int is usually still a 32 bit type.

Instead of using intptr_t , the code is guaranteed to be large enough to hold int or an indicator.

Then you should do this

  intptr_t y = ...; Foo (reinterpret_cast & lt; lPBYTE & gt; (y));  


No comments:

Post a Comment