Yes but my doubt is:
lets suppose that I have two dynamic arrays of bytes, wi and wo. If I do:
setLength(wi,1);
setLength(wi[0],3);
wi[0,0]:=1;
wi[0,1]:=2;
wi[0,2]:=3;
now in memory I have a stream like this:
(I know that there are control bytes, but for semplicity)
0x01 0x02 0x03
now if I do:
setLength(wo,1);
setLength(wo[0],3);
wo[0,0]:=40;
wo[0,1]:=50;
wo[0,2]:=60;
now my stream is:
0x01 0x02 0x03 0x40 0x50 0x60
now I decide to make wi bigger:
setLength(wi[0],6);
wi[0,3]:=4;
wi[0,4]:=5;
wi[0,5]:=6;
Now in memory I should find something like this:
0x01 0x02 0x03 0x40 0x50 0x60 0x04 0x05 0x06
Now, if I do:
iCount:=length(wi);
strm.Write(iCount,sizeOf(integer));
for a := 0 to length(wi)-1 do
begin
iCount:=length(wi[a]);
strm.Write(iCount,sizeOf(integer));
if icount>0 then // added
strm.Write(wi[a][0],sizeOf(double)*iCount); // [0] added.
end;
Am I sure that in the stream I will find 0x01 0x02 0x03 0x04 0x05 0x06 and not 0x01 0x02 0x03 0x40 0x50 0x60 ?
Unfortunately it is diffuclt to make tests about it because 99% of cases it could go well and 1% go wrong but it is important to know.