From: "Peña, Botp" Date: 2009-01-30T11:51:53+09:00 Subject: Re: Can't create a new file From: Nebs Petrovic [mailto:nebs_man@hotmail.com] # myfile = File.new("somefile.txt", "r+") myfile = File.new("somefile.txt", "w") ^^^^^^^ # myfile.puts "Hello" # myfile.close try using the block form File.open since it opens and close for you, eg create the file, > File.open("somefile.txt", "w") do |f| f.puts "Hello" end #=> nil then read it back > File.open("somefile.txt", "r") do |f| puts f.gets end Hello #=> nil