[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[silpa-discuss] Re: Help required in solving an issue
From: |
Laxminarayan Kamath |
Subject: |
[silpa-discuss] Re: Help required in solving an issue |
Date: |
Thu, 29 Apr 2010 09:05:35 +0530 |
No no, He is first calculating byte offsets for each line and storing
in array (that happens in loadLineOffsets function (he got that from
some stackoverflow thread). Then he uses the offsets to quickly jump
to the required line. If I am not wrong , in line no 44 he is doing
fp.seek(line_offsets[int(lineno)])
which causes off by 1 error .. If he wanted 50th line's byte offset it
is getting offset of 51st line.
I think
fp.seek(line_offsets[int(lineno) -1 ])
is correct
--
Laxminarayan Kamath Ammembal
http://lankerisms.blogspot.com
(+91) 9945036093