title: Want to know the length of a buffer C++
body: <p>I am new to C++ and programming and I would like to know if there is a way to get the length of a pointer.<br>
  Let's say Myheader is a struct with different types of data inside.<br>
  My code goes like this:</p>
  
  <pre><code>char *pStartBuffer;
  memcpy(pStartBuffer, &amp;MyHeader, MyHeader.u32Size);
  </code></pre>
  
  <p>So I want to know the length of the buffer so that I can copy the data to a file using QT write function.</p>
  
  <pre><code>file.write(pStartBuffer, length(pStartBuffer));
  </code></pre>
  
  <p>How can I do this?</p>