file4 = File.new("C:\\Ruby\\Sample", "r+") puts file4.sysread(20) file4.syswrite("ABCDEF") # write ABCDEF from the 21st character onward.