P
Phillip Rhodes
Hi all, I have a question I hope someone can help me with:
I'm doing some communication over a socket, and have need to send
and receive values of type double. I'm doing everything in terms
of single byte reads and writes to the socket, so what I need to do
is take the individual bytes I receive, that represent a double, and
actually turn them into a double. This I'm struggling to figure
out.
I can easily combine the bytes into a container of some sort
(like say a long) that has the same bit pattern as the double
I want. For example, I can get to the point of having a long
that looks like 0001 1110 1000 0000 for 7.5d. But I can't
seem to get that into a double. A simple cast doesn't appear
to work, and I'm not sure what else to try.
Any help or ideas is greatly appreciated.
Thanks,
Phillip Rhodes
I'm doing some communication over a socket, and have need to send
and receive values of type double. I'm doing everything in terms
of single byte reads and writes to the socket, so what I need to do
is take the individual bytes I receive, that represent a double, and
actually turn them into a double. This I'm struggling to figure
out.
I can easily combine the bytes into a container of some sort
(like say a long) that has the same bit pattern as the double
I want. For example, I can get to the point of having a long
that looks like 0001 1110 1000 0000 for 7.5d. But I can't
seem to get that into a double. A simple cast doesn't appear
to work, and I'm not sure what else to try.
Any help or ideas is greatly appreciated.
Thanks,
Phillip Rhodes