I thinh, Louis wants to know how the two bytes will be understood as a word.
Louis experiment with that:
type TBytesOrWord = record
case integer of
0 : (b: array[0..2] of byte);
1 : (w: word);
end;
var
Form1: TForm1;
ba : TBytesOrWord;
implementation
{$R *.DFM}
procedure TForm1.FormActivate(Sender: TObject);
begin
Memo1.Clear;
ba.b[0] := 107;
ba.b[1] := 0;
Memo1.Lines.Add(Format('%d %d',[ba.b[0],ba.b[1]]));
Memo1.Lines.Add(Format('%d',[ba.w]));
end;
(It returns:
107 0
107
in other words(ha!) the lower byte is recorded first in a word. Try the other
way...
)
Horia
________________________________________
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of
Rob Kennedy
Sent: Monday, May 23, 2005 12:18 PM
To: [email protected]
Subject: Re: [delphi-en] Byte array
Louis Young wrote:
> If I've got an array of bytes, what is the byte order, i.e.
>
> is 0000 0000 0110 1011
>
> represented as (0, 107) or (107, 0)?
The byte order of an array of bytes is exactly what it says it is.
Element 0 comes before element 1 comes before element 2, etc.
It's only when your element size is larger than one byte that the byte
order matters.
--
Rob
-----------------------------------------------------
Home page: http://groups.yahoo.com/group/delphi-en/
To unsubscribe: [EMAIL PROTECTED]
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/delphi-en/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/