I am parsing a header in a file. The file has some float value it wants me to extract. The comments say its a float32 value but I'm not sure how to extract it.
Given a buffer like this, how do I properly extract this? Note it is little endian.
unsigned char b[4];
b[0] = 0xa1;
b[1] = 0xb2;
b[2] = 0xc3;
b[3] = 0xd4;
float f = b[0] | b[1] << 8 | b[2] << 16 | b[3] << 24;
printf("f is %f\n", f);
To be more clear: the problem is that no matter what the value in the file (buffer) the decimal is always .000000. How do I know where that decimal should go?