Re: Question about GTK+ and timers



On Sat, 9 Apr 2011 00:14:45 -0700
Igor Korot <ikorot01 gmail com> wrote:
[snip]
> Is there any way to find out if the device is little- or big-endian?

Which device are you referring to?  You appear to be writing some
code for a machine receiving data sent over a wire, and that machine's
endianness can be tested by seeing whether G_BYTE_ORDER is defined as
G_LITTLE_ENDIAN or G_BIG_ENDIAN, and then used for conditional
compilation purposes. glib also has some built in byte-swapping macros:

http://developer.gnome.org/glib/stable/glib-Byte-Order-Macros.html

However the thing that puzzles me is that there are other issues here,
apart from the byte order of data elements whose size is greater than 1.
As another poster has pointed out, the format of the data stream
requires specification somewhere.  How do you know it is sent as structs
with the potentially compiler-dependent layout that you referred to?  As
I mentioned (and others have mentioned) earlier, what is being sent is
serialised data.  What you need to know is how the data packet layout
of the serialised data is specified and work from there.

Chris




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]