From: Pit Capitain Date: 2008-08-14T16:42:17+09:00 Subject: Re: Is it possible to extract data out of memory using Ruby? 2008/8/14 Erik Terpstra : > Is it possible to extract data out of memory using Ruby? Erik, to read and write longs (4 bytes) I use the DL standard library with the following code: require "dl" ptr = DL::PtrData.new 0 ptr.struct! "L", "val" size = ptr.size # read ptr[ address, size ].unpack( "L" )[ 0 ] # write ptr[ address, size ] = [ val ].pack( "L" ) For reading and writing bytes you have to change the "L" to something else. See the docs for the DL standard library. Regards, Pit