title: How do I over-allocate memory using new to allocate variables within a struct?
body: <p>So I have a couple of structs...</p>
  
  <pre><code>struct myBaseStruct
  {
  };
  
  struct myDerivedStruct : public myBaseStruct
  {
      int a, b, c, d;
      unsigned char* ident;
  };
  
  myDerivedStruct* pNewStruct;
  </code></pre>
  
  <p>...and I want to dynamically allocate enough space so that I can 'memcpy' in some data, including a zero-terminated string. The size of the base struct is apparently '1' (I assume because it can't be zero) and the size of the derived is 20, which seems to make sense (5 x 4).</p>
  
  <p>So, I have a data buffer which is a size of 29, the first 16 bytes being the ints and the remaining 13 being the string.</p>
  
  <p>How can I allocate enough memory for pNewStruct so that there is enough for the string? Ideally, I just want to go:</p>
  
  <ul>
  <li>allocate 29 bytes at pNewStruct;</li>
  <li>memcpy from buffer into pNewStruct;</li>
  </ul>
  
  <p>Thanks,</p>