title: ruby: `read': Invalid argument -(Errno::EINVAL) at File.read
body: <p>I'm doing a simple script to check crc of all files...</p>
  
  <pre><code>require "zlib"
  exit if Object.const_defined?(:Ocra)
  
  files = Dir.glob("*")
  
  File.open('dir.txt', 'a+') do |file|  
   file.puts files
  end
  
  File.read('dir.txt').each_line { |line|
      file = File.read(line) ; nil
      file_crc = Zlib.crc32(file,0).to_s(16)
      puts line, file_crc
  }
  </code></pre>
  
  <p>The problem is at the line <code>File.read('dir.txt').each_line { |line|</code>
  I get this error:</p>
  
  <pre><code>test.rb:13:in `read': Invalid argument - 1.exe (Errno::EINVAL)
          from C:/Users/Administrador/Desktop/1.rb:13:in `block in &lt;main&gt;'
          from C:/Users/Administrador/Desktop/1.rb:12:in `each_line'
          from C:/Users/Administrador/Desktop/1.rb:12:in `&lt;main&gt;'
  </code></pre>
  
  <p>PD: <code>1.exe</code> is a file listed in the "dir.txt".</p>