Calculate field offset in a typed record
From: Rudi Loos (loos_at_intekom.co.za)
Date: 12/29/03
- Previous message: Christian Bode: "screenshot and CPU encumbrance / pfDevice and bmDIB"
- Next in thread: KLinZ: "Re: Calculate field offset in a typed record"
- Reply: KLinZ: "Re: Calculate field offset in a typed record"
- Reply: AlanGLLoyd: "Re: Calculate field offset in a typed record"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 29 Dec 2003 02:42:00 +0200
Hi
I have looked on the web and in the groups but to no avail. Can anyone
explain how I can calculate the offset of a field with respect to the
record. e.g.:
TMyrecord = packed record
Field1 : Integer;
Field2 : Array [0..25] of byte;
......
Field24 : Word;
Field25 : String[13]
end;
I would like to calculate the offset to field24 with respect to MyRecord.
I have large records that I use to communicate with an electronic device and
want to pass an address and byte count so that I will only need to read 2
bytes at address Field24.
I tried to subtract the pointers but I get an error "operation not
applicable"
Thanks to everyone in the group that continually provides help.
Rudi
- Previous message: Christian Bode: "screenshot and CPU encumbrance / pfDevice and bmDIB"
- Next in thread: KLinZ: "Re: Calculate field offset in a typed record"
- Reply: KLinZ: "Re: Calculate field offset in a typed record"
- Reply: AlanGLLoyd: "Re: Calculate field offset in a typed record"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|