Mega Code Archive

 
Categories / Ruby / File Directory
 

Seek by position

f = open('binary') f.seek(8) f.pos                                      f.seek(-4, File::SEEK_CUR) f.pos                                      f.seek(2, File::SEEK_CUR) f.pos                                      # Move to the second-to-last byte of the file. f.seek(-2, File::SEEK_END) f.pos