From: Ned Konz Date: 2002-07-08T13:35:46+09:00 Subject: Re: How to determine EOF with sysread? On Sunday 07 July 2002 08:58 pm, Jim Freeze wrote: > Hi: > > How does one determine the eof when using > sysread. The example below seems to indicate > that using #eof? corrupts the file pointer. So don't use eof?. Use the EOFError that sysread raises at the end of file: buff_size = File.stat(ARGV[0]).blksize File.open(ARGV[0]) { |f| begin loop { buff = f.sysread(buff_size); print buff } rescue EOFError print "\nDone.\n" end } -- Ned Konz http://bike-nomad.com GPG key ID: BEEA7EFE