Errno::ENOENT: No such file or directory - rubytestfile
thanks for any help!
Try
aFile = File.new("rubytestfile", "w")
If you don't specify the 2nd argument (the open mode) Ruby assumes you want to open the file for reading only. If the file doesn't exist, you can't read it.
Errno::ENOENT: No such file or directory - rubytestfile
thanks for any help!
Try
aFile = File.new("rubytestfile", "w")
If you don't specify the 2nd argument (the open mode) Ruby assumes you
want to open the file for reading only. If the file doesn't exist, you
can't read it.
And please use the block form from the start, i.e.
File.open("rubytestfile", "w") do |aFile|
aFile.puts "hello"
end
Btw, the original script wrote to stdout and not to the file.