Autor Beitrag
Dhakiyah
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 327
Erhaltene Danke: 5

Windows 7
Delphi XE2
BeitragVerfasst: Mi 17.09.08 10:14 
Hallo!
Irgendwie tue ich mich schwer damit...

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
implementation

{$R *.dfm}

var datei: TextFile;
    s: string;

procedure TForm1.FormCreate(Sender: TObject);
begin
  AssignFile(datei, 'test.txt');
  if FileExists('test.txt'then ReSet(datei)
  else ReWrite (datei);
end;

procedure TForm1.FormDestroy(Sender: TObject);
begin
  CloseFile(datei);
end;

procedure TForm1.StartenClick(Sender: TObject);
begin
  read(datei, s);
  memo.text := s;
end;

end.
MDX
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 595
Erhaltene Danke: 4

Windows 8.1, Linux Debian 8, Android Lollipop
Delphi, PHP, Java (Android)
BeitragVerfasst: Mi 17.09.08 10:25 
Machs doch einfach so:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
procedure TForm1.FormCreate(Sender: TObject);
var
FILENAME:String;
begin
  FILENAME = 'C:\test.txt';
  if FileExists(FILENAME) then 
  memo.lines.loadfromfile(FILENAME);
  else showmessage('Datei '+FILENAME+' kann nicht geöffnet werden!');
end;


Fertig!