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); var LineNew: string; begin LineNew := ReadFile('C:\Changes.txt'); if LineNew <> LineOld then begin Memo1.Lines.Add(LineNew); LineOld := LineNew; end; end;
Related Articles and Replies