Greeting's
I need to convert 4 bytes in a float, I searched the forums but the answers were all about VB and I can't find an equivalent to the BitConverter method, here's a piece of code from a thread by theoxyde :
byte[] input = new byte[4]; // 32-bit byte array
// put your bytes into the array in correct order
float f = BitConverter.ToSingle( input, 0 );
I can do the bit sorting (it seems ok - I compare the bytes with a Matlab array that was writted by our client) the problem is that I'm unable to tell the compiler to interpret the bits in the field as a float32. Is there (of course there is) an operator or a method that can take the raw data and interpret it as a float?
Simon Lapierre
slapierre@sonomax.com
I need to convert 4 bytes in a float, I searched the forums but the answers were all about VB and I can't find an equivalent to the BitConverter method, here's a piece of code from a thread by theoxyde :
byte[] input = new byte[4]; // 32-bit byte array
// put your bytes into the array in correct order
float f = BitConverter.ToSingle( input, 0 );
I can do the bit sorting (it seems ok - I compare the bytes with a Matlab array that was writted by our client) the problem is that I'm unable to tell the compiler to interpret the bits in the field as a float32. Is there (of course there is) an operator or a method that can take the raw data and interpret it as a float?
Simon Lapierre
slapierre@sonomax.com