title: Reading specific bytes out of a byte array and converting them to hexadecimal representation, using Objective-C++
body: <p>I am trying to convert a GUID C++ structure into a string representation of the guid. The GUID structure is defined as follows: </p>
  
  <pre><code>typedef struct _GUID {
  ul_u_long   Data1;
  ul_u_short  Data2;
  ul_u_short  Data3;
  ul_byte     Data4[ 8 ];
  } GUID;
  </code></pre>
  
  <p>I am having a problem with converting the Data4 to string. A description of this structure can be found here: <a href="http://msdn.microsoft.com/en-us/library/aa373931%28VS.85%29.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/aa373931%28VS.85%29.aspx</a>. From the description, the first 2 bytes of this byte array represents one group of 4 hexadecimal digits and the next 6 bytes contains the second group of 12 hexadecimal digits. </p>
  
  <p>So, given a guid like this 6B29FC40-CA47-1067-B31D-00DD010662DA, the byte array stores <em>B31D</em> in the first 2 bytes and <em>00DD010662DA</em> in the next 6 bytes. </p>
  
  <p>So, with this guid as an example, and assuming that I have a variable of type GUID with the name <em>ulguid</em>, what I am trying to do is to extract <em>B31D-00DD010662DA</em> from the byte array <em>ulguid.Data4</em> with objective-c++. How would I go about doing this?</p>