From: markus jais Date: 2001-08-08T06:56:50+09:00 Subject: [ruby-talk:19311] how to redirect $sdtout hi, I am just trying to convert some perl cookbook examples to ruby for the pleac project (http://pleac.sourceforge.net) Now I am stuck with the following from chapter 7.0 of the perl cookbook $old_fh = select(LOGFILE); # switch to LOGFILE for output print "Countdown initiated ...\n"; select($old_fh); # return to original output print "You have 30 seconds to reach minimum safety distance.\n"; my ruby solution does not work! logfile = File.new("log.txt", "w+") old = $stdout.clone $stdout.reopen(logfile) print "Countdown initiated ...\n"; $stdout.reopen(old) old.close print "You have 30 seconds to reach minimum safety distance.\n"; both strings are written to stdout and the file log.txt is empty. can anybody tell me why?? I found something similar in the mailing list archive, but it just doesn't work regards markus -- Markus Jais http://www.mjais.de info@mjais.de The road goes ever on and on - Bilbo Baggins