Home > Back-end >  Delphi how the multidimensional dynamic array in the document flow
Delphi how the multidimensional dynamic array in the document flow

Time:09-29

Read from the file stream multidimensional arrays,
Var
Myfile: TfileStream;
Mybuf: Treal;
I, j: Integer;
The begin
Myfile:=TfileStream. Create (' d:/a.t xt, fmOpenRead);
Setlength (mybuf, 10, 15);
Myfile. Readbuffer (mybuf [0, 0], myfile. Size);
//delete (String (mybuf), 1, myfile. Size - 4);
For I:=0 to 9 do
For j:=0 to 14 do
Memo1. Lines. The Add (formatfloat (' 0 ', mybuf [I, j]));
Myfile. Free;
The end;

Written to the file stream from the multi-dimensional array,
Procedure TForm1. Button2Click (Sender: TObject);
Var
Myfile: TfileStream;
Mybuf: Treal;
I, j: Integer;
The begin
Myfile:=TfileStream. Create (' d:/a.t xt, fmCREATE);
Setlength (mybuf, 10, 15);
For I:=0 to 9 do
For j:=0 to 14 do
Mybuf [I, j] :=I + j;
myfile. Writebuffer (mybuf (0, 0), 10 * 15 * sizeof (real)); !!!!!!!!!! write data not
Myfile. Free;
  • Related