Autor Beitrag
fishhed
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 77


Delphi 7
BeitragVerfasst: Mo 08.01.07 11:07 
Hallo zusammen,

ich habe eine Liste von Strings in einer Textdatei.

Ein Programm greift darauf zu. Es solle immer jeweils die 1. Zeile der Liste auslesen.
Danach soll die 1. Zeile gelöscht werden.

Wie macht man das am einfachsten?

Vielen Dank,

Marcel
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Mo 08.01.07 12:29 
Moin!

user profile iconfishhed hat folgendes geschrieben:
Wie macht man das am einfachsten?

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
var
  Datei: TStringList;
begin
  Datei := TStringList.Create;
  try
    Datei.LoadFromFile('C:\test.txt'); // Datei laden
    if (Datei.Count > 0) then begin // Datei hat min. 1 Zeile?
      ShowMessage(Datei.Strings[0]); // was damit tun, z.B. anzeigen
      Datei.Delete(0); // erste Zeile löschen
    end;
    Datei.SaveToFile('C:\test.txt'); // Datei speichern
  finally
    Datei.Free;
  end;

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
fishhed Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 77


Delphi 7
BeitragVerfasst: Mo 08.01.07 13:19 
Allerbesten Dank Narses, das funktioniert so Bestens!!!