[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Using unsigned shorts
- From: mchalkley@...
- Date: Wed, 21 Nov 2012 12:29:31 -0500
I'll have to try that - it would certainly be the easy way, since this
is just a hack tool anyway.
That having been said, I've been looking at struct (having never used
it before), and it looks like it would be very useful in some other
stuff I'm using, so I should learn that, too...
Wednesday, November 21, 2012, 12:18:19 PM, you wrote:
> On Wed, Nov 21, 2012 at 07:03:36PM +0200, steve donovan wrote:
>> On Wed, Nov 21, 2012 at 4:49 PM, <mchalkley@mail.com> wrote:
>> > I have to send and receive UDP packets containing unsigned shorts, for
>> > a diagnostic tool I'm writing.
>>
>> How about Roberto's struct library?
> I would have thought that if you have a string 's' containing the two
> bytes of the short, this is just fine:
> x = (string.byte(s, 1) * 256) + string.byte(s, 2)
> B.