pos=(p1)
public
Seeks to the given position (in bytes) in ios.
f = File.new("testfile")
f.pos = 17
f.gets
Show source
/*
* call-seq:
* ios.pos = integer => integer
*
* Seeks to the given position (in bytes) in <em>ios</em>.
*
* f = File.new("testfile")
* f.pos = 17
* f.gets
*/
static VALUE
rb_io_set_pos(io, offset)
VALUE io, offset;
{
rb_io_t *fptr;
off_t pos;
pos = NUM2OFFT(offset);
GetOpenFile(io, fptr);
pos = io_seek(fptr, pos, SEEK_SET);
if (pos != 0) rb_sys_fail(fptr->path);
clearerr(fptr->f);
return OFFT2NUM(pos);
}