Daniel Harple wrote: > 2006/5/17, Damphyr <damphyr / freemail.gr>: >> >> begin >> ###do some magic to get the stdout from this point on into a string >> load file1.rb >> ###do some more magic to put stdout back where it was. >> end >> >> Has anyone a solution for this? > > require 'stringio' > stdout = StringIO.new > $stdout = stdout > load "file1.rb" > $stdout = STDOUT > stdout.rewind > puts "got: #{stdout.read}" # => got: Output of meaningful code omitted > > -- Daniel I am wondering whether Ruby has something similar to C++ stringstream, and you give the answer. It is happy to see it. Best regards. uncutstone -- Posted via http://www.ruby-forum.com/.