title: how to find my error(delphi)
body: <p>i'm getting an I/o 998 error, my task is to rewrite numbers from file to array, and find max and min values. What i'm doing wrong ?</p>
  
  <pre><code>implementation
  
  var
    f2: file of Real;
    m: array of Real;
  
  procedure TForm1.Button1Click(Sender: TObject);
  var 
    f: Real;
    max, min: Real;
    i, j: Integer;
  begin
    AssignFile(F2, 'test3.dat');
    Rewrite(f2);
  
    for i := 1 to 50 do
    begin
      f := RandomRange(-100, 100);
      Randomize;
      Write(f2, f);
    end;
  
    CloseFile(f2);
  
    i := 0;
  
    Reset(f2);
  
    while not Eof(f2) do
    begin
      SetLength(m, i);
      Read(f2, m[i]);
      Inc(i);
    end;
  
    CloseFile(f2);
  
    max := m[1];
    min := m[1];
  
    for j := 1 to i do
      if m[j] &gt; max then
        max := m[j]
      else 
      if m[j] &lt; min then
        min := m[i];
  </code></pre>