open file for text read
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
open file for text read
hello ppl, i have a text file that gets data from a shell every second, in livecode i use open file for text read and then read from file until eof, the problem is that eventualy the file gets too large and livecode takes too much time to read it, the questing: is there a way to keep track of the last position read from was at ? or there any way at all to speed up the procesing time of the text if it gets too large?
Knowledge is meant to be shared.
Re: open file for text read
"read from file" in the dictionary suggests there is a start character and an end character.
So you'd just track those.
Simon
So you'd just track those.
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
Re: open file for text read
Hey there simon, thank you for your time helping.
I'm assuming that you mean i should use a buffer with the characters every time i read from the file, well i'v tryied this and its just as slow as reading the whole file, basicly the code takes some numbers from the txt and adds them then it puts them in a var, what i want is to add the numbers then put them in the var and the next time it reads from the txt it should only add the lines added to the txt, not all of it...
if i misunderstood your suggestion let me know
I'm assuming that you mean i should use a buffer with the characters every time i read from the file, well i'v tryied this and its just as slow as reading the whole file, basicly the code takes some numbers from the txt and adds them then it puts them in a var, what i want is to add the numbers then put them in the var and the next time it reads from the txt it should only add the lines added to the txt, not all of it...
if i misunderstood your suggestion let me know

Knowledge is meant to be shared.
Re: open file for text read
this seems to do it:
but it's sloppy. Not sure if there is any more speed.
Simon
Code: Select all
global tCount
on mouseUp
set the defaultFolder to specialFolderPath("desktop")
open file "temp.txt" for read
read from file "temp.txt" at tCount until EOF
put it
put the (number of chars of it + 1) into tCount
if tCount = 1 then put 0 into tCount
close file "temp.txt"
end mouseUp
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!