Extract data from uint8 to double
Posted
by
HADJ AMOR HASSEN
on Stack Overflow
See other posts from Stack Overflow
or by HADJ AMOR HASSEN
Published on 2012-10-02T15:15:49Z
Indexed on
2012/10/02
15:37 UTC
Read the original article
Hit count: 154
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.
© Stack Overflow or respective owner