Am Tue, 28 Aug 2001 13:44:22 -0400, hat "Ryan" <ryan / ryanflynn.com> geschrieben:
> 
> >
> > def read_f(name)
> >     n = 0
> >     line = ""
> >     f = File.open(name)
> >     f.each_line{|line|
> >         n += 1
> >     }
> >     n
> > end
> 
> Instead of looping couldn't you just do:
> 
> puts IO.readlines("c:/file.txt").length
> 
> ? I'm a newbie, so feel free to correct me if this is not kosher.
> 
> 
> 
Thank you for the hint. But my question was not how to determine the number of lines or the file length but to read a file 
efficiently. This becomes interesting when you are working on large files. Getting a look at Python. There it possible to 
read the file in chunks of bytes. That increases speed dramatically. The same feature would be helpful in Ruby.

Michael