Das LoadFromFile gehört aber auch in den Ressourcenschutzblock, sonst hat man nen schönes Speicherleck, wenn dort ein Fehler auftritt.
Also ordentlich formatiert so ca.:
Delphi-Quelltext
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15:
| var posi1, a: Integer; finish: TStringList; begin finish := TStringList.Create; try finish.LoadFromFile('c:\datei.txt'); for a := 0 to finish.Count - 1 do begin posi1 := Pos('Such text', finish[a]); ListView.Items.Add.Caption := Copy(finish[a], posi1, 50); end; except finish.free; end; |