On 15-Jan-07, at 10:10 AM, w wg wrote:

> But the "i" and "I" modifer don't care bytes order.
> I'm reading data from network using IO#sysread, I need receive integer
> , not unsigned integer.
>
> Thank you for your reply.

OK then, what about "V"? "treat 4 characters as an unsigned long in  
little-endian byte order"

The N uses network byte order "big-endian"

Mike


>
> 2007/1/15, Mike Stok <mike / stok.ca>:
>>
>> On 15-Jan-07, at 8:29 AM, w wg wrote:
>>
>> > Hi
>> > I' m using unpack to convert 4 bytes to local integer, but ruby  
>> just
>> > supply the "N" modifer  which means unsigned long integer.
>> >
>> > My questions is :
>> > How to unpack 4 bytes to a signed integer ?
>>
>>
>> There are "i" and "I" for signed and unsigned integer respectively,
>> which deals in the local size of integer.
>>
>> Hope this helps,
>>
>> Mike
>>
>> --
>>
>> Mike Stok <mike / stok.ca>
>> http://www.stok.ca/~mike/
>>
>> The "`Stok' disclaimers" apply.
>>
>>
>>
>>
>>
>>
>
>
> -- 
> --
> WenGe Wang
>
>

-- 

Mike Stok <mike / stok.ca>
http://www.stok.ca/~mike/

The "`Stok' disclaimers" apply.