On Wed, 27 Apr 2005, James Edward Gray II wrote: > I'm working with StringIO to write some test code and it is behaving > strangely. Check out this example: > > irb(main):001:0> require "stringio" > => true > irb(main):002:0> fake_file = StringIO.new > => #<StringIO:0x3119cc> > irb(main):003:0> fake_file.puts "This is a test." > => nil > irb(main):004:0> fake_file.string > => "This is a test.\n" > irb(main):005:0> fake_file.truncate(0) > => 0 this is consistent with file behaviour: [ahoward@localhost ~]$ env PAGER=cat man truncate | grep pointer The file pointer is not changed. try: irb(main):005:0> fake_file.truncate(fake_file.rewind) hth. -a -- =============================================================================== | email :: ara [dot] t [dot] howard [at] noaa [dot] gov | phone :: 303.497.6469 | although gold dust is precious, when it gets in your eyes, it obstructs | your vision. --hsi-tang ===============================================================================