/* * call-seq: * ios.seek(amount, whence=SEEK_SET) -> 0 * * Seeks to a given offset <i>anInteger</i> in the stream according to * the value of <i>whence</i>: * * IO::SEEK_CUR | Seeks to _amount_ plus current position * --------------+---------------------------------------------------- * IO::SEEK_END | Seeks to _amount_ plus end of stream (you probably * | want a negative value for _amount_) * --------------+---------------------------------------------------- * IO::SEEK_SET | Seeks to the absolute location given by _amount_ * * Example: * * f = File.new("testfile") * f.seek(-13, IO::SEEK_END) #=> 0 * f.readline #=> "And so on...\n" */ static VALUE rb_io_seek_m(argc, argv, io) int argc; VALUE *argv; VALUE io; { VALUE offset, ptrname; int whence = SEEK_SET; if (rb_scan_args(argc, argv, "11", &offset, &ptrname) == 2) { whence = NUM2INT(ptrname); } return rb_io_seek(io, offset, whence); }