filetail TdcFileTail component
Properties Events
Return to Introduction  Previous page  Next page
Overview
The dcFileTail is the utility component with functionality similar to the tail command in Unix. It monitors files for their changes and triggers the event where program can receive appended part of data. Also, like the tail command of Unix it can return specified number of text lines from the end of file (very useful to receive some last entries from log-files), see LastLines and LastLinesCount properties.  
 
Besides the "tail" features, it can be used to perform simple monitoring of file changes (either constant monitoring in separate thread, or "manual" monitoring by executing special method). You probably know that when you modify the code of your unit outside of the Delphi IDE, when that unit are currently opened, the IDE notifies you about changes and prompts whether you want to use modified sources… The dcFileTail can do this monitoring for you.  

How to use?
Just specify the file which you would like to monitor in the FileName property, and this file will be monitored. At once the file changed, the component will triggers OnFileChanged and/or OnFileAppended events (with OnFileAppended you can receive the data which was just appended to file.  
 
If you would like to retrieve some lines from the end of file — read them from LastLines property. The number of returned lines can be adjusted in LastLinesCount property. To get current size of file — use FileSize property.  
 
If you don't want to constantly check whether file is modified, just switch the MonitorType property to mtCheckByRequest and execute CheckChanges method in the OnActivate event of your form.