Aktonius Posted January 5, 2012 Share Posted January 5, 2012 I am openning a file as a $handle and reading it. This file is opened by another program(also belongs to it as its log file). I need some data from this log for automation help. What i am usually doing is using FileReadLine() to get what this app is constantly writting in this log file BUT sometimes FileReadLine() will return -1 (end of line?!) even i am 100% sure that there is more data to read but my filereadline() somehow skipped that data?! This normally works fine but happens rarely. So its like while 1 $line = filereadline($loghandle) ;sometimes filereadline wont read the data even its there and it will keep returning -1 wend Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 5, 2012 Moderators Share Posted January 5, 2012 Aktonius,It is obvious that the problem is in line #2345. Seriously, how on earth can we offer any advice without sight of the code you are using? FileReadLine is not the easiest of functions to use - without any code to work on we cannot offer more than very basic suggestions. My first thought is that you are calling the function so often that you are advancing the internal line counter faster than the other app is adding lines. That would explain why you are getting the -1 (end of file, not line) error. But show us the code and we will see if we can do better. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Aktonius Posted January 5, 2012 Author Share Posted January 5, 2012 Aktonius,It is obvious that the problem is in line #2345. Seriously, how on earth can we offer any advice without sight of the code you are using? FileReadLine is not the easiest of functions to use - without any code to work on we cannot offer more than very basic suggestions. My first thought is that you are calling the function so often that you are advancing the internal line counter faster than the other app is adding lines. That would explain why you are getting the -1 (end of file, not line) error. But show us the code and we will see if we can do better. M23Sorry for not much code but this example is just to huge to post all details, i thought it would just add confusion but i will post something up later.Also since you said that filereadline() could advance line counter, wouldnt this be impossible if the end of file(nothing was written) is detected?So basically if it reads that nothing was written or -1 doesnt it continue reading from the same line when something actually is written?like...readline = -1 (position 2345)readline = -1 (position 2345)readline = -1 (position 2345)readline = -1 (position 2345)readline = -1 (position 2345)readline = (something is written) (position increases)isnt this correct? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 5, 2012 Moderators Share Posted January 5, 2012 Aktonius, I have no idea - I did say that the suggestion was only my initial thought. Please try and get some form of reproducer script - without it we are really just stumbling around in the dark as anything I might code is very unlikely to look like what you are using. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now