Project

General

Profile

Feature #17833

Updated by dsisnero (Dominic Sisneros) over 3 years ago

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

 #17834  

 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  
 

Back