C++ Char array conversion to Hex or char array
<p>I would appreciate for some C++ expertize advice on this please. I have a Char array  </p>

<pre><code>     &lt;unsigned char ch1[100];&gt; 
</code></pre>

<p>data (ASCII code) gets filled in this ( max 6 or 8 array spaces and rest is empty). I want to process valid bits in the array only either converting them to  Hex or again Char array. I tried </p>

<pre><code>     &lt;memcpy (ch1,ch2,sizeof(ch1))&gt;
</code></pre>

<p>but all garbage values are also copied..... :( </p>

<pre><code>       &lt;strcpy gives me an error&gt;
</code></pre>

<p>also number of bytes copied are dynamic ( 1 time :- 4; 2 time :- 6.....)  </p>
