Re: Seg fault reading data from IOChannel



On Tue, 3 Feb 2009 13:01:24 +0000
Chris Vine <chris cvine freeserve co uk> wrote:
> However, as has already been mentioned you should pass sizeof(int)
> not 4 when reading and writing the int value - you cannot assume any
> particular integer size, as that is platform and processor dependent.
> Assuming the reader and write are on the same machine you don't need
> to worry about endianness, but if they are on different machines (you
> are communicating over a network other than localhost) then you do
> need to worry about it.

Actually, if you are communicating over a network other than localhost,
you can't use sizeof(int) either because the two machines may have
different integer sizes.  You would need to use a fixed size integer
such as guint32.

Chris



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