HT de Beer
1/19/2006 10:55:00 AM
On Thursday 19 January 2006 11:49, John Maclean wrote:
> Following the example from "pickaxe book", second edition, p128
>
> #!/usr/bin/ruby
> File.open("testfile", "r") do |file|
> while line = file.gets
> puts line
> end
> end
>
> produces
> copy.rb:2:in `initialize': No such file or directory - testfile
> (Errno::ENOENT) from copy.rb:2
The problem is clear. You are trying to read a file which does not exist. So,
to solve the `problem', you create a file named testfile, put some text in
it, and there you go,
--
HT de Beer