Is your binary fixed length and what "endian" is it?  I'm confused when you
say that a binary of 0 and 10 is "0A".  Surely this is "02".  I'm sure
there's something in STL that will help.

Cheers,

Steve.
p.s.  reminds me of a strap-line I once see:
Understanding binary is as easy as 01 10 11  :)

-----Original Message-----
From: Adam Straughan [mailto:[EMAIL PROTECTED]
Sent: 24 September 2003 11:19
To: [EMAIL PROTECTED]

Assuming that I understand

byte b[] = new byte[]{0,10};
string s = "";
for(int i=0 ; i < b.Length ; i++)
    s=b[i].ToString("X") + s;

adam

Randy Collins wrote:
> I am calling a 3rd party win32 api function that is returning binary
> data from a mainframe into a StringBuilder type parameter. This
> function also takes a length parameter to tell it how big the
> StringBuilder buffer is.
>
> My question is, how to I format this binary data as a hex string?
> That is, if the buffer contains two bytes, a binary 0 and a binary 10
> (decimal), I return "0A".
>
> Thanks
>
> ===================================
> This list is hosted by DevelopMentor(r)  http://www.develop.com NEW!
> ASP.NET courses you may be interested in:
>
> 2 Days of ASP.NET, 29 Sept 2003, in Redmond
> http://www.develop.com/courses/2daspdotnet
>
> Guerrilla ASP.NET, 13 Oct 2003, in Boston
> http://www.develop.com/courses/gaspdotnet
>
> View archives and manage your subscription(s) at
> http://discuss.develop.com

===================================
This list is hosted by DevelopMentor(r)  http://www.develop.com
NEW! ASP.NET courses you may be interested in:

2 Days of ASP.NET, 29 Sept 2003, in Redmond
http://www.develop.com/courses/2daspdotnet

Guerrilla ASP.NET, 13 Oct 2003, in Boston
http://www.develop.com/courses/gaspdotnet

View archives and manage your subscription(s) at http://discuss.develop.com

===================================
This list is hosted by DevelopMentor�  http://www.develop.com
NEW! ASP.NET courses you may be interested in:

2 Days of ASP.NET, 29 Sept 2003, in Redmond
http://www.develop.com/courses/2daspdotnet

Guerrilla ASP.NET, 13 Oct 2003, in Boston
http://www.develop.com/courses/gaspdotnet

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to