how to convert a binary array with hex values into decimal and then to a string
<p>I have a binary array with hex values and i would like to convert it into decimal. once that is done i would like to display it in a string.</p>

<p>BTW i am working on an intel process via unbuntu and this will probably be used on a sun many hp unix box.</p>

<p>so the question i have is that when i do a straight up assignment to unsigned long it works..as in the decimal part. i still have not made that into a string yet. but i amnot sure why it works. furthermore i read somewhere that when you put it in unsinged long the you will not have to worry about endianess. </p>

<p>could i get some help on how to take this issue and why the aforementioned works as well?</p>

<p>please note: i am using c++ and not the .net stuff so bitconverter is not available</p>

<p>thanks</p>

<p><strong>EDIT</strong> (Copied from answer to own question below)  </p>

<p>first of all thanks for the endian link that IBM article really helped. knowing that i was just putting it into a register rather than manually putting the byte values in consecutive memory locations is what takes away the whole endianess issue made a big difference. </p>

<p>here is a pc of code that i wrote which i know can be better but its just something quick...</p>

<pre><code>// use just first 6 bytes
byte truncHmac[6];
memset( truncHmac, 0x00, 6 );
unsigned long sixdigit[6];
for (int i=0; i&lt;=5; i++)
{
    truncHmac[i]=hmacOutputBuffer[i];
    sixdigit[i]=truncHmac[i];
    std::cout&lt;&lt;sixdigit[i]&lt;&lt; std::endl;
}
</code></pre>

<p>the output is</p>

<pre><code>HMAC: 76e061dc7512be8bcca2dce44e0b81608771714b
118
224
97
220
117
18
</code></pre>

<p>which makes sense that its take the first six bytes and converting them to decimals.</p>

<p>the only question i have now is how to make this into a string..someone mentioned using manipulators? could i get an example?</p>

<p>thanks a bunch guys you all rock!</p>
