File Operation

Can you tell me if I can move to a perticular Line number like 'C'?

···

--
Posted via http://www.ruby-forum.com/.

What C library allows to "move to a particular line number"? I am not
aware of something like that and it can work efficiently only if you
have an index or lines with uniform length.

Please look at IO#tell and IO#seek. If you want line by line jumping
there is no other way as to read the file from the beginning and stop
at the appropriate line number.

The only option to speed that up is to build up an index of lines and
then use IO#seek to position accordingly. If you also write to the
file that approach will soon get very complicated.

Kind regards

robert

···

2009/10/26 Subhas Mazumder <subhas.mazumder@tcs.com>:

Can you tell me if I can move to a perticular Line number like 'C'?

--
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/

Thanks Robert

···

--
Posted via http://www.ruby-forum.com/.