'===========================================================================
' Subject: HOW TO READ WORD/DWORD VALUES      Date: 06-26-99 (13:29)       
'  Author: Tom Lake                           Code: QB, QBasic, PDS        
'  Origin: comp.lang.basic.misc             Packet: FAQS.ABC
'===========================================================================
'> Want to read a structure like in C
'>
'> struct
'>     b as byte
'>     c as word
'>     d as dword
'> end struct
'>
'> Tryed..
'> struct
'>     b as byte
'>     c as int
'>     d as long
'> end struct
'>
'> Is there some kind of signed unsigned int, long ?
'> Or how can i do this ?

'You can read them in as signed and then convert them to unsigned yourself.

FUNCTION Unsign#(x AS INTEGER, bits as INTEGER)
    Unsign = x - (2 ^ bits * (x < 0))
END FUNCTION

'To convert an word, use 16 for bits, to convert a dword, use 32 for bits:

Unsign(-1, 16) = 65535
Unsign(-1, 32) = 4294967295


'Tom Lake
'ICQ #25589135
