Cyri Posted February 17, 2010 Share Posted February 17, 2010 (edited) Looking for some clarification on something. I'm trying to monitor a log file and want to know if the following code is valid to go back to the previous line in a file? Can I have more than one file handle open to the same file? $file = FileOpen($sLogFile, 0) ;Loop to check file While 1 $file_temp = $file $line = FileReadLine($file) If @error <> -1 Then $file_temp = "" ;do stuff here to validate readline Else $file = $file_temp ;Set file object back to previous line ExitLoop EndIf Wend I may not even be doing this the correct way to begin with. The code above doesn't show the big picture, but I'm trying to avoid having to do a FileOpen every time I want to validate new entries in the log file. The log file gets really big and I don't want the performance hit of having to read through all the lines I've already gone over. I suppose I could keep a line count reference so the FileReadLine() can pick up where I last left off. Is that the best way? Edited February 17, 2010 by Cyri Link to comment Share on other sites More sharing options...
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!Register a new account
Already have an account? Sign in here.Sign In Now