unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    Label1: TLabel;
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var f:textfile;
    i:integer;
begin
  label1.Caption:='Zawartość pliku liczby.txt:';
  if FileExists('liczby.txt') then  //jeśli plik istnieje w bieżącym folderze
  begin
    AssignFile(f,'liczby.txt');
    Reset(f);
    while not Eof(f) do
    begin
      Readln(f,i);
      Label1.Caption:=Label1.Caption+#13+IntToStr(i);
    end;
    CloseFile(f);
  end
  else ShowMessage('Brak pliku o nazwie liczby.txt');

end;

end.
