Autor Beitrag
Asgar
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 160

XP Home Edition
D5
BeitragVerfasst: Di 03.05.05 11:17 
Hallo erstmal.
Weis einer vieleicht wie ich in eine Textdatei einen string reinschreibe, aber dabei nicht am anfang der Datei anfange sondern erst ab einer bestimmten zeile.
chrisw
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 439
Erhaltene Danke: 3

W2K
D7
BeitragVerfasst: Di 03.05.05 11:27 
An eine bestimmte Stelle in einer Datei "springen" mit Seek, aber ich denke Du willst etwas ganz Anderes ! Erzähl doch mal was Du erreichen willst !

_________________
Man sollte keine Dummheit zweimal begehen, die Auswahl ist schließlich groß genug.
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19339
Erhaltene Danke: 1752

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Di 03.05.05 11:29 
@chrisw: Er hat von Zeilen gesprochen, das wird mit Seek etwas :lol: komplizierter...

Also die wohl einfachste Möglichkeit dürfte eine StringList sein.

Beispiel:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
var
  MyList: TStringList;
begin
  MyList := TStringList.Create;
  MyList.LoadFromFile(...Dateiname...);
  if MyList.Count > 1 then
    MyList.Insert(1'Test für Zeile 2')
  else
    MyList.Add('Was denn, nur eine Zeile???');
  MyList.SaveToFile(...Dateiname...);
  MyList.Free;
end;
Asgar Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 160

XP Home Edition
D5
BeitragVerfasst: Di 03.05.05 11:50 
Das ist nicht ganz das was ich suche, trozdem Danke, habe grade eine lösung gefunden.