Autor Beitrag
tiffy89
Hält's aus hier
Beiträge: 8



BeitragVerfasst: Mi 14.03.07 18:58 
hallo zusammen!

ich wüsste gerne, wie ich es anstelle, dass delphi mir den text in einer .txt nicht immer überschreibt. wie man den text zum ersten mal in eine txt bekommt hab ich hier nachgelesen...

www.delphi-forum.de/...light=text+speichern

aber wie gesagt, delphi überschreibt den text beim erneuten versuch. kann man das verhindern?

schon mal danke im vorraus
tiffy89
Calculon
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 676

Win XP Professional
Delphi 7 PE, Delphi 3 PRO
BeitragVerfasst: Mi 14.03.07 19:19 
Schau dir doch mal den Befehl FileExists an.

Dann kannst in einer if-Abfrage überprüfen, ob die Datei bereits existiert.

Gruß

Calculon
--
tiffy89 Threadstarter
Hält's aus hier
Beiträge: 8



BeitragVerfasst: Mi 14.03.07 20:06 
ok, so wäre es auch eine möglichkeit, aber ich dachte eher daran, dass der neue text in der selben datei gespeichert wird, nur eben eine zeile darunter. kennt jemand dafür ne lösung?

danke
tiffy89
Marco D.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: Mi 14.03.07 20:08 
Text in Stringlist laden. Neuen Eintrag mit Stringlist.Add hinzufügen und neu abspeichern.

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
tiffy89 Threadstarter
Hält's aus hier
Beiträge: 8



BeitragVerfasst: Mi 14.03.07 20:10 
@marco
ich kenne mich nicht soo wahnsinnig gut aus. wie sähe denn ein beispiel-quelltext für so etwas aus?

vlg
tiffy89
Marco D.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: Mi 14.03.07 20:14 
user profile icontiffy89 hat folgendes geschrieben:
@marco
ich kenne mich nicht soo wahnsinnig gut aus. wie sähe denn ein beispiel-quelltext für so etwas aus?

vlg
tiffy89

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
var sl: TStringlist;

sl := TStringlist.Create;
sl.LoadFromFile(dateipfad);
sl.Add('neue zeile');
sl.SaveToFile(dateipfad);
FreeAndNil(sl):

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
tiffy89 Threadstarter
Hält's aus hier
Beiträge: 8



BeitragVerfasst: Mi 14.03.07 20:37 
hey cool! es funktioniert! vielen dank :)