From: 7stud -- Date: 2008-05-11T09:29:03+09:00 Subject: Re: How to update a file? Cheyne Li wrote: > Hi there > > Does anyone know how to write a string at the end of a file? contents = IO.read("data.txt") print contents puts File.open("data.txt", "a") do |file| file.print("this is the last line\n") end new_contents = IO.read("data.txt") print new_contents --output:-- hello world goodbye hello world goodbye this is the last line -- Posted via http://www.ruby-forum.com/.