I think that when Randy is talking about binary 1 and binary 10 he is talking about mainframe datatypes, thus converting this into pc datatypes you get
byte of 0 and 10 is "0A", which seems correct to me :) Randy, correct me if i am wrong. // Ryan -----Original Message----- From: Stephen Dunn To: [EMAIL PROTECTED] Sent: 24-09-2003 14:06 Subject: Re: [ADVANCED-DOTNET] Binary data to string representation of hex values 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 ------------------------------------- The information included in this message is personal and/or confidential and intended exclusively for the addressees as stated. This message and/or the accompanying documents may contain confidential information and should be handled accordingly. If you are not the intended reader of this message, we urgently request that you notify Centric immediately and that you delete this e-mail and any copies of it from your system and destroy any printouts immediately. It is forbidden to distribute, reproduce, use or disclose the information in this e-mail to third parties without obtaining prior permission from Centric. We expressly point out that there are risks associated with the use of e-mail. Centric and the companies within the group shall not accept any liability whatsoever for damage resulting from the use of e-mail. Legally binding obligations can only arise for Centric by means of a written instrument, signed by an authorized representative of Centric. ------------------------------------- =================================== 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
