Nice job on tracking that down.  I'm sure there are other examples but
in TPP's src/mzXML/common directory you can look at the Base64 and
ScanConverter.cpp for code examples and some documentation on the
encoding.

-Natalie

On Fri, Feb 4, 2011 at 6:56 AM, dre <[email protected]> wrote:
> Actually I think I figured it out....in case anyone else out there is
> wondering - if you have a c-style char array holding your hex value,
> it will be automatically converted to the host endianess when type
> casting into an integer. So then the bytes have to be reconverted
> again (network to host) before used. This was a little bit hard to see
> at first but now it seems to make sense. ex:
>
> unsigned char your_bytes[4] = 43BE1959;
> unsigned long your_integer = (unsigned long) your_bytes;
>
> //this will give 2.70467 E15 which is at first unintuitive, but if you
> consider that when casting a char to an int your getting an endianness
> change it makes sense
>
> so instead
>
> unsigned long you_integer = ntoh ((unsigned long) your_bytes);
>
> //this will then give the true value of 380.19
>
> --
> You received this message because you are subscribed to the Google Groups 
> "spctools-discuss" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/spctools-discuss?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"spctools-discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/spctools-discuss?hl=en.

Reply via email to