Skip to content

End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →

instance method

IO#pos=

ios.pos = integer → integer

Seeks to the given position (in bytes) in ios. It is not guaranteed that seeking to the right position when ios is textmode.

Example
f = File.new("testfile")
f.pos = 17
f.gets   #=> "This is line two\n"
See also #pos #pread #pid #pressed? also in 4.1 · 4.0 · 3.4 · 3.3 · 3.2 · 3.1