(libruby) reading a file line by line

Prehaps something like this

f = File.open("inventory")
f.each do |hostName|
  hostName.chomp!
end

···

-----Original Message-----
From: Phil Jackson [mailto:phil@shellarchive.co.uk]
Sent: Thursday, May 25, 2006 10:34 AM
To: ruby-talk ML
Subject: (libruby) reading a file line by line

Hi All,

Basically what I would like to do is read a file in line by line
chomping
the line on the way. It's easy enough in c but I would like to do it
using
the functionality from libruby.

I've go the file object using rb_file_open(), can someone suggest how I
might use each_line to do what I want to?

Cheers,
Phil

Hi,

[ top post fixed ]

Basically what I would like to do is read a file in line by line chomping
the line on the way. It's easy enough in c but I would like to do it
using the functionality from libruby.

I've go the file object using rb_file_open(), can someone suggest how I
might use each_line to do what I want to?

Prehaps something like this

f = File.open("inventory")
f.each do |hostName|
  hostName.chomp!
end

Thanks for the answer but I may have been un-clear. I'm wanting to do this
from a c program using libruby.

Cheers,
Phil

···

On Fri, May 26, 2006 at 02:41:13 +0900, Zach Buckholz wrote: