Recent

Author Topic: Date to textfile  (Read 3474 times)

T-bear

  • Full Member
  • ***
  • Posts: 160
Date to textfile
« on: December 07, 2010, 08:51:15 pm »
How do i write the systemdate into a textfile? :-[
Thanks!

typo

  • Hero Member
  • *****
  • Posts: 3051
Re: Date to textfile
« Reply #1 on: December 07, 2010, 09:19:30 pm »
Code: [Select]
var
  fs :TFileStream;
  s :string;
begin
  s := DateToStr(Now);
  fs := TFileStream.Create('file.txt', fmCreate);
  try
    fs.Write(s[1], Length(s));
  finally
    fs.Free;
  end;
end;     
« Last Edit: December 07, 2010, 11:46:05 pm by typo »

T-bear

  • Full Member
  • ***
  • Posts: 160
Re: Date to textfile
« Reply #2 on: December 07, 2010, 09:35:27 pm »
Thanks!
And how do i open the text in a textfile into a TMemo?

typo

  • Hero Member
  • *****
  • Posts: 3051
Re: Date to textfile
« Reply #3 on: December 07, 2010, 09:36:53 pm »
Code: [Select]
Memo1.Lines.LoadFromFile('file.txt');

 

TinyPortal © 2005-2018