On Tue, Aug 24, 2010 at 4:34 PM, Rajarshi Chakravarty
<raj_plays / yahoo.com> wrote:
>
> My 2nd question is how can I read a file char by char. Basically the
> file doesn't have line breaks.

How big is your file? IO.read("/path/to/file") will read the entire
file into a string. If you really want to read it character by
character

File.open("/path/to/file") do |f|
  while true do
    begin
      a = f.readchar
      # do something with a
    rescue EOFError
      break
    end
  end
end

martin