Is it not possible to access the data in the memory of a TidBytes buffer with typecasting? Say I have:
type
TMyRecord = packed record
Field1 : integer ;
Field2 : packed array [0..1023] of byte ;
end ;
var
Buffer : TIdBytes ;
MyRecord : TMyRecord ;
begin
IdTCPClient1.IOHandler.ReadBytes (Buffer, SizeOf (TMyRecord), false) ;
with TMyRecord (Buffer) do // compiler snags with "invalid typecast"
...
OK, so I can use:
BytesToRaw (Buffer, MyRecord, SizeOf (TMyRecord)) ;
but is there no way of accessing the data directly without the overhead of copying it?