Extract data from uint8 to double
- by HADJ AMOR HASSEN
I have a C function receiving a uint8 pointer with another parameter which is its size (number of bytes).
I want to extract double data from this buffer. Here is my code:
Write(uint8* data, uint8 size) /* data and size are given by a callback to my function)*/
{
double d;
for (i = 0; i < size; i++)
{
d = ((double*)&data)[i];
printf(" d = %d\n");
}
}
The problem is that I am not receiving what I am sending within an external hardware. I guess that my cast is wrong. I tried other methods but without any good result. I am still not able to get what I send.