W. D. said:
Many, many thanks for all your help!!!! You have helped me trudge
along in this project.
Right now I am stumped on some fairly simple C code that
initializes a packed struct/record:
memset(&PackedStruct, 0, sizeof(PackedStruct));
Does anyone have some idea how to do this in Delphi?
Many thanks to Stephen Posey!...who suggested:
FillChar(PackedStruct, SizeOf(TPackedStruct), 0);
Now I am stumped again with a 'new' dynamic allocation
line:
PackedStruct.maindata = new uint8[MAX_DATA_LEN];
I looked around: in the Help file, here:
http://www.delphibasics.co.uk/RTL.asp?Name=New
and other places on the 'Net, but not sure
what to do. Can this statement be done on
one line in Delphi?
FYI, the RECORD type looks similar to this:
type
Packed_Struct = PACKED record
soh: UINT8;
Data_Type: UINT8;
Data_Size: UINT16;
maindata: UINT8;
CRC: UINT16;
// In the C++ code there is something like:
// Packed_Struct()
// ~Packed_Struct()
// Are these by chance constructor and destructor?
// If so, would this code make sense: