02-10-2016 10:47 AM
Hi
I need to read a BSON message, when I show the string in a indicator(backslash notation) it is like this:
\03position\00\13\00\00\00\10x\00@\01\00\00\10y\00\00\01\00\00
I don't know how to get the U32 values (in bold) after x and y position, any idea?
Thanks a lot
02-10-2016 10:57 AM
Break those 4 bytes out of the string, use typecast with a U32 constant wired in to convert that to a U32 value.
02-11-2016 10:46 AM
Than you.
After breaking in 4 bytes, I had to convert it to byte array (U8), then a typecast to u32 to get the value.
02-11-2016 11:51 AM
02-11-2016 12:08 PM
@GerdW wrote:Hi Pau,
you don't need to convert to U8 array, just typecast your string (of 4 chars) to U32…
Or use Unflatten From String. I prefer the Unflatten just in case the data decides to be Little Endian instead of Big Endian. The Type Cast assumes Big Endian.