pos=(p1)
public
Seeks to the given position (in bytes) in
ios. It is not guaranteed that seeking to the right position when
ios is textmode.
f = File.new("testfile")
f.pos = 17
f.gets
Show source
static VALUE
rb_io_set_pos(VALUE io, VALUE offset)
{
rb_io_t *fptr;
off_t pos;
pos = NUM2OFFT(offset);
GetOpenFile(io, fptr);
pos = io_seek(fptr, pos, SEEK_SET);
if (pos < 0 && errno) rb_sys_fail_path(fptr->pathv);
return OFFT2NUM(pos);
}