Convert built in types to vector<char>
<p>My TcpClient class accepts <code>vector&lt;char&gt;</code> in its SendData method like this:</p>

<pre><code>void CTcpClient::SendData(const vector&lt;char&gt;&amp; dataToTransmit)
</code></pre>

<p>Therefore, in order to use the function, I have to convert any built in type (int, long, short, long long) to a <code>vector&lt;char&gt;</code>.  </p>

<p>I tried several solutions using streams but always end up with an ASCII representation of the number I want to convert (I also tried to use binary flags without success). But I need the binary values of the numbers. </p>

<p>For example:</p>

<pre><code>int num = 0x01234567
vector&lt;char&gt; whatIWant = {0x01, 0x23, 0x45, 0x67}
</code></pre>

<p>What solution would you suggest?</p>

<p>Thanks for any help! </p>
