From: "Ara.T.Howard" Date: 2005-10-13T05:26:23+09:00 Subject: Re: Problem subclassing IO and writing on Windows On Thu, 13 Oct 2005, Berger, Daniel wrote: > Hi all, > > Windows XP Pro > Ruby 1.8.2 > > The following snippet dies on Windows with: > > subtest.rb:8:in `write': not opened for writing (IOError) > from subtest.rb:8:in `write_stuff' > from subtest.rb:14 > > Works fine on *nix. Am I doing something wrong? Or is this a bug? > > # subtest.rb > class MyIO < IO > def initialize(arg) > super(arg) > binmode > end def initialize *a, &b super *a binmode b and b.call end > > def write_stuff > write("Hello World") > end > end > > mio = MyIO.new(File.open("test.txt","wb+").fileno) > mio.write_stuff > mio.close > puts "Done" hth. -a -- =============================================================================== | email :: ara [dot] t [dot] howard [at] noaa [dot] gov | phone :: 303.497.6469 | Your life dwells amoung the causes of death | Like a lamp standing in a strong breeze. --Nagarjuna ===============================================================================