what is the proper way to fill members from raw data
<p>I have a pointer to raw data using const u_char*, and a generic class like this</p>

<pre><code>class Rectangle 
{
   u_int8_t length;
   u_int8_t height;
   ...
}
</code></pre>

<p>Assuming the raw data is a binary "stream" of bytes, what is the best way to get the raw data into the fields of the class.</p>

<pre><code>-memcpy ?
-cast   ?
</code></pre>

<p>i <em>could</em> do this :</p>

<pre><code>Rectangle *rect = (Rectangle*)rawdata;
</code></pre>

<p>but i know that is a "old style" cast.</p>

<p>What is the proper way ?</p>
