Issue #17833 has been reported by dsisnero (Dominic Sisneros).

----------------------------------------
Feature #17833: add IO.readinto(b) where b is a bytes like object that is you can get a memoryview from
https://bugs.ruby-lang.org/issues/17833

* Author: dsisnero (Dominic Sisneros)
* Status: Open
* Priority: Normal
----------------------------------------
assuming you have a ByteArray class that we can get a memoryview from

ba = ByteArray.new(8)

mv_at_4 = Fiddle::MemoryView.new(ba)[4..-1]

f = File.open('/dev/urandom', 'rb'){|s| s.readinto(mv_at_4) # write the content of /dev/urandom from offset 4 to the end of the bytearray, effectively reading only 4 bytes



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>