From: "Peña, Botp" Date: 2008-07-31T10:31:24+09:00 Subject: Re: IO.pos bug? From: John Slobbe [mailto:john.slobbe@gmail.com] # Same here...on ruby 1.8.7 (2008-06-20 patchlevel 22) [i686-linux] # irb(main):001:0> f = File.new("/etc/hosts") # => # # irb(main):002:0> f.sysread(5) # => "#\n# /" # irb(main):003:0> f.pos # => 5 # irb(main):004:0> f.sysread(10) # => "etc/hosts:" # irb(main):005:0> f.pos # => 5 i seem to remember (don't know where/when) that you must not mix low level calls like #sysread w highlevel calls like #pos, use #read with #pos, or use #sysread w #sysseek but i guess we need a confirmation fr the core dev to verify that. Nobu perhaps? eg, irb(main):016:0> File.open "/etc/hosts" do |f| irb(main):017:1* f.sysread 2 irb(main):018:1> p f.sysseek(0,IO::SEEK_CUR) irb(main):019:1> f.sysread 10 irb(main):020:1> p f.sysseek(0,IO::SEEK_CUR) irb(main):021:1> end 2 12 => nil irb(main):022:0> RUBY_VERSION => "1.8.7" hth. kind regards -botp