Open a file in a mode where it can be read from and written to at the same time
f = File.open("text.txt", "r+") puts f.gets f.puts "This is a test" puts f.gets f.close