title: Is there a way to solve an I/O error 6 in Delphi?
body: <pre class="lang-pascal prettyprint-override"><code>procedure TfrmSongs.Display;
  var
    i: Integer;
  begin
    redOutput.Clear;
    redOutput.Lines.Add('The TOP 10');
    for i := 1 to iCount-1 do
    begin
      redOutput.Lines.Add(IntToStr(i)+arrSongs[i]);
    end;
  end;
  
  procedure TfrmSongs.FormActivate(Sender: TObject);
  var
    tSongList: TextFile;
    sSong: string;
  begin
    iCount := 0;
    AssignFile(tSongList, ExtractFilePath(Application.ExeName)+'Songs.txt');
    Reset(tSongList);
    while not EOF do
    begin
      Readln(tSongList, sSong);
      arrSongs[iCount] := sSong;
      Inc(iCount);
    end;
    CloseFile(tSongList);
    Display;
  end;
  </code></pre>
  
  <p>I'm trying to display the array I tried to create via a text file in a rich edit. But every time I run the app, it gives me an 'I/O error 6' error and nothing displays. I don't know if it's something with the text file or if it's something with the display procedure.</p>