[ENet-discuss] Sending numerical values in packets
Mika Halttunen
lsoft at mbnet.fi
Sat Nov 8 05:59:57 PST 2003
> If both your machines are of the same architecture, or use the same
> float format, you can just send the data as is.
But *how* can I send numbers as is? How to stuff them into a char array
without using sprintf? I don't want to use sprintf/sscanf, because -
like you mentioned - the values would be larger than necessary. I'm
pretty sure that you can store a uint32 or a float into 4 bytes, and
using sprintf with, say, 12345 would already use more than 4 bytes. I
tried to experiment with casting numerical values to the array, but I
couldn't get it work with Mingw.
Thanks!
--
Mika Halttunen
lsoft at mbnet.fi
More information about the ENet-discuss
mailing list