TStringList.SaveToFile
И Edit.Text закинуть в Stinglist?
давно сделал небольшую но полезную процедурку procedure WriteTextToFile(FileName: string; const Text: string; const BOM: TBytes); var FS: TFileStream; MS: TMemoryStream; Dir: string; s: Utf8String; begin if Text = '' then Exit; LogLock.Enter; try MS := TMemoryStream.Create; try s := Utf8Encode(Text); MS.Write(Pointer(s)^, Length(s)); MS.Seek(soFromBeginning, 0); if FileExists(FileName) then FS := TFileStream.Create(FileName, fmOpenWrite) else begin Dir := ExtractFileDir(FileName); CheckDirectory(Dir); try FS := TFileStream.Create(FileName, fmCreate); except Exit; end; if Length(BOM) > 0 then FS.Write(Pointer(BOM)^, Length(BOM)); end; try FS.Seek(0, soEnd); FS.CopyFrom(MS, MS.Size); finally FreeAndNil(FS); end; finally FreeAndNil(MS); end; finally LogLock.Leave; end; end;
https://docwiki.embarcadero.com/Libraries/Athens/en/System.IOUtils.TFile.WriteAllText
TFile.WriteAllText(FileName, Edit.Text)
https://t.me/Delphi_Lazarus/326372
Да увидел я уже)
Обсуждают сегодня