On Thu, 22 Jul 2004, tony summerfelt wrote:

> what's the easiest way to iterate through a Tempfile?
>
> basically i want to append the contents of a tempfile (created by
> Tempfile.new) to the end of a regular file (created by File.open)

t = Tempfile.new $$
t.puts 42
t.close
t.open

# or t.flush

open('file','a+'){|f| f.write t.read}

-a
--
===============================================================================
| EMAIL   :: Ara [dot] T [dot] Howard [at] noaa [dot] gov
| PHONE   :: 303.497.6469
| A flower falls, even though we love it;
| and a weed grows, even though we do not love it. 
|   --Dogen
===============================================================================