Chris Gther schrieb: > That's exactly the solution I already have. What I dont like about this > solution is that you have to open and close file descriptors 3 times > just for patching one little file (For sure a working solution but quite > some overhead). In order to patch an existing file, all you have to do is >> File.open(FNAME,"rb+") {|fd| >> fd.pos=OFFSET >> fd.write(VALUE) >> p "written modified piece of data = '#{VALUE}'" >> } The other File.open calls are for creating the test file and for testing the contents of the patched file. I copied them from your initial script. Of course you could do all three steps (create, patch, test) in a single File.open block. Regards, Pit