Reputation: 21
Is there a way I can use coding Memo1.lines.savetofile ('textfile1.txt') without it then deleting whatever already is in the texfile to save the memos lines?
Upvotes: 1
Views: 4943
Reputation: 598001
Create a TFileStream
that opens the existing file, seek to the end of the stream, and then pass the stream to Memo1.Lines.SaveToStream()
.
Upvotes: 10
Reputation: 613461
Presumably you want to append the text to the file. Do that like so:
TFile.AppendAllText(FileName, Memo1.Text);
This uses the TFile
class from the IOUtils
unit. Pass an encoding parameter if you want to exercise control over the encoding used.
Upvotes: 4