From: Tim Hunter Date: 2009-07-15T03:56:15+09:00 Subject: Re: sysread problems __ __ wrote: > I want to open a file and store its contents in an array. When I read > the documentation for sysread, it seemed to be just what I wanted. > However, when I actually run my code, it returns only part of the file > successfully. It seems the amount of the file returned successfully > varies with the file, but it is always vastly smaller than the file > itself, and it always starts at the beginning of the file. For example, > with a file about 1 MB in size, the amount sysread returned successfully > was about 500 bytes. If you're running on Windows, and the files you're reading contain binary data (that is, not plain text), then I'm guessing that Ruby is encountering a ^Z character and interpreting it as EOF. You can fix this by opening the file in binary mode, i.e. "rb" instead of plain "r". -- Posted via http://www.ruby-forum.com/.