title: How to iterate through each byte of an LPBYTE in C++
body: <p>Excuse the simplicity of my question, I'm not used to working with Windows types.</p>
  
  <p>I have an LPBYTE buffer and i wish to XOR each byte of it with another byte.</p>
  
  <p>What is the proper way of getting the length of the buffer and iterating through it in C++? I'm trying to do something akin to:</p>
  
  <pre><code>LPBYTE buf = *something*;
  char key = 'X';
  
  for(int i=0;i&lt;len(buf);i++)
      buf[i] = buf[i] ^ key;
  </code></pre>
  
  <p>Many Thanks!</p>