procedure TForm1.btn1Click(Sender: TObject); var astr: string; sList: TStrings; path: string; begin sList := TStringList.Create; path := ‘C:\a\b.txt‘; try if not DirectoryExists(ExtractFilePath(path)) then begin ForceDirectories(ExtractFilePath(path)); end; if FileExists(path) then begin sList.LoadFromFile(path); end; sList.Add(FormatDateTime(‘YYYY-MM-dd‘, now) +‘:‘+ #13#10 + mmo1.Text); sList.SaveToFile(path); finally sList.Free; end; end;
转自:http://blog.sina.com.cn/s/blog_4bc47d230101eief.html
时间: 2024-10-12 15:32:46