Originally Posted By: ziv
Any check of whether the file changed or not would be pointless, since you gotta find out what changed anyways.
You might as well go right away and scan the file for the changes.


that is extremely illadvised, a very quick and simple check such as $file().mtime is certainly not pointless as you save mIRC the trouble of having to load a potentially large file into memory and 'scan' it or otherwise when it doesn't have to. if this check is performed even slightly more often than the file is modified, it should be employed. consider what would happen if the external application was such that it added lines to the end of the file, on average, every 30 seconds (it is a paging application after all). what you're advocating will traverse the file line by line with the notoriously slow $read() until it either reaches the end or finds a line change. now imagine this being done on a significantly sized file every second (or however often the OP deems suitable), resulting in an unnecessarily intensive check an average of 29 out of 30 times.

that is why simple checks such as those on $file().mtime are valuable, it allows you to abandon the operation and save yourself extra unnecessary overhead on a good portion of thse checks. then, if the mtime has changed, we can go forward with a more thorough test such as the one you described (though preferably with file handling commands or such)


"The only excuse for making a useless script is that one admires it intensely" - Oscar Wilde