From: Ross Bamford Date: 2006-10-14T18:09:27+09:00 Subject: Re: IO.readint ? On Sat, 2006-10-14 at 02:42 +0900, Tim Pease wrote: > On 10/13/06, Robert Klemme wrote: > > On 12.10.2006 18:10, Kalman Noel wrote: > > > > class IO > > def geti( endian = :little ) > > str = read( [0].pack('N').length ) > > str.reverse! if endian == :little > > str.unpack( 'N' )[0] > > end > > end > > > > Ooooo ... clever! > > class IO > SIZEOF_INT = [0].pack('N').length > > def geti( endian = :little ) > str = read( SIZEOF_INT ) > str.reverse! if endian == :little > str.unpack( 'N' )[0] > end > end I thought that 'N' was _always_ a 32-bit in network byte order? According to the docs, platform independent sizes are used everywhere except the SsIiLl directives when escaped by an underscore...? -- Ross Bamford - rosco@roscopeco.REMOVE.co.uk