Re: Detect file change

Posted by DelphiLand Team on January 01, 2005

In Reply to: Detect file change posted by james on December 30, 2004

So you only want to add the last line of Changes.txt if that last line has changed, if I understand you well?

In that case, remember that last line in a global variable, say a string variable LineOld. Next time, only add a new line to the memo when it is different from LineOld. Example:

procedure TForm1.Timer1Timer(Sender: TObject);
  LineNew: string;
  LineNew := ReadFile('C:\Changes.txt');
   if LineNew  <> LineOld then begin
     LineOld := LineNew;

Good luck!
Jim, DelphiLand Team

Related Articles and Replies