Hello everybody,
I need the actual bytes of a double and a float, i tried to use bitwise operators but this was not possible (Compiler says no, probably for a good reason?). Unions work great on floats and double's, but the problem is (besides that unions are bit frowned upon in this case, i believe?) the resulting bytes will eventually be send over a network connection, and may go from a X86 computer to a PPC machine (or vice versa). Using bitwise operators on an int or short is no problem on both platforms, since they provide the same result. But when i use an union on a double and on a float the result is different.
So i have been pondering over a solution. I even tried casting the double to a long int and tried using bitwise operators on them, but that failed.
So, how do i get the actual bytes of a double and of a float?