From: nobu.nokada@... Date: 2003-11-27T14:10:36+09:00 Subject: Re: [BUG] File#rewind, File#syswrite, File#pos on Cygwin build Hi, At Thu, 20 Nov 2003 18:50:20 +0900, ts wrote: > R> "Do not mix with other methods that write to ios or you may get > R> unpredictable results." > R> http://www.rubycentral.com/book/ref_c_io.html#IO.syswrite > > No, no. Robert is correct. Note that IO#pos is shorthand for seek(0, IO::SEEK_CUR) which an interface for fseek, that means it is buffered IO routine. You have to use #sysseek instead. > puts "Now at position #{file.pos}" puts "Now at position #{file.sysseek(0, IO::SEEK_CUR)}" > moulon% ruby -v b.rb > ruby 1.8.0 (2003-08-04) [sparc-solaris2.7] > Now at position 3330 > Now at position 0 > 46 bytes written > Now at position 46 > moulon% > > the problem is in cygwin and linux ... This behavior is not guaranteed. And also, once stdio layer operation is done, whether sysio works well or not is unknown. -- Nobu Nakada