Project

General

Profile

Actions

Feature #17833

open

add IO.readinto(b) where b is a bytes like object that is you can get a memoryview from

Added by dsisnero (Dominic Sisneros) about 2 months ago. Updated about 2 months ago.

Status:
Open
Priority:
Normal
Assignee:
-
Target version:
-
[ruby-core:103606]

Description

ba = ByteArray.new(8) # ByteArray implements memoryview

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

Related

#17834
#17831

Actions #1

Updated by dsisnero (Dominic Sisneros) about 2 months ago

  • Description updated (diff)
Actions #2

Updated by dsisnero (Dominic Sisneros) about 2 months ago

  • Description updated (diff)
Actions

Also available in: Atom PDF