I opened the file in ruby ββwith a + parameters. I can search the middle of the file and read from it, but when I try to write records, it always goes all the way. How to write a record in the middle?
jpg = File.new("/tmp/bot.jpg", "a+") jpg.seek 24 puts jpg.getc.chr jpg.seek 24 jpg.write "R" jpg.seek 28 jpg.write "W" puts jpg.pos jpg.close
R and W end at the end of the file.
I know that I can only overwrite existing bytes, thatβs fine, thatβs what I want to do.
robin
source share