Hello,
I am aware of the need for ntohl and htonl.
But floats?
I am aware of Beej's (Brian "Beej Jorgensen" Hall) implementation:
http://beej.us/guide/bgnet/output/ht....html#htonsman
Yet, I devised my own kludge:
------------------------
uint32_t data, data1;
float num1;
i =read(descriptor, (char *) &data, sizeof(uint32_t));
data1 = ntohl(data);
num1 = *(float*) ( &data1);
--------------------------
This works for me; always has!
Now, mind you, I have done scientific coding.
And in an enviroment with extremley well-behaved floats,
where round-off has never been an issue.
And very little exceptions....
So...
Why does my simpler implementation work?
What problems could it cause?
Friends have advised me to use Jorgensen, but I do not see the need.
(I also have not gotten it to work)
Thanks,
tom