Harisankar P S wrote in post #1136028:
> Oh sorry i missed out an important thing. The 'w' attribute in the file
> open means the file is open only for writing, we need to open for
> reading.
> So just update the code as so
>
> fo = File.open('test.txt', 'r')

Still an error you would get, as you didn't close it. It will be as 
below :

fo = File.open("testfile.odt", "w")
fo.write("foo/nbar/nbaz/n")
fo.close

fo = File.open("testfile.odt", "r")
line = fo.lineno

puts line

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