name pipe wrote: > Hello, > > I have some text to be written to a file. > After receiving data from webrick server I modify it lil bit and then > write it to a file. > > fd = File.open("file.txt", "w") You can use open("file.txt", "w") as well. > fd.puts "#{data}" Why not just fd.puts data as for the empty file problem, maybe try to close fd: fd.close Peter http://www.rubyrailways.com