Autor Beitrag
Borg-Cube
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 38


Delphi 2009
BeitragVerfasst: Sa 31.01.04 20:21 
Hallo

Ich habe hier ein Textfile und möchte gerne eine zeile nach der anderen Auslesen. Mit folgendem Code kann ich nur die erste Zeile auslesen. Wo und wie muss ich da eine schleife einbauen um jede Zeile zu erhalten?

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
var tf:TextFile;
     user,pfad:string;
begin
   pfad:='c:\Datei.txt';

   AssignFile(tf, pfad);
   Reset(tf);
   Readln(tf, user);
   main.status.Lines.Add(user);

   CloseFile(tf);
delphist
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 64

WIN XP, 98, 95; SUSE LINUX 8.1, 6.1, 6.0

BeitragVerfasst: Sa 31.01.04 20:34 
Lese es als TStringList!
Dan kannst du drauf zu kommen mit .Item[0] etc.

_________________
3w + freehostlist + de
3w + bild-stoerung + de
toms
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1099
Erhaltene Danke: 2



BeitragVerfasst: Sa 31.01.04 20:37 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
var
  tf: TextFile;
  user, pfad: string;
begin
  pfad := 'c:\Datei.txt';
  AssignFile(tf, pfad);
  Reset(tf);
  repeat
    Readln(tf, user);
    main.status.Lines.Add(user);
  until EOF(tf);
  CloseFile(tf);
end;
BungeeBug
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 901



BeitragVerfasst: Sa 31.01.04 21:36 
Hi,

die Möglichkeit geht ist aber schlecht wenn die Textdatei leer ist ;)

ausblenden Delphi-Quelltext
1:
2:
3:
4:
WHILE not EOF(<file>) DO
 BEGIN
  readln(<file>,<variable>);
 END;


Kommt besser :)
Borg-Cube Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 38


Delphi 2009
BeitragVerfasst: So 01.02.04 00:56 
Danke.

Habs hingekriegt.