D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
proc
/
self
/
root
/
opt
/
alt
/
ruby34
/
share
/
ri
/
system
/
IO
/
Filename :
seek-i.ri
back
Copy
U:RDoc::AnyMethod[iI" seek:ETI"IO#seek;TF:publico:RDoc::Markup::Document:@parts[ o:RDoc::Markup::Paragraph; [I"5Seeks to the position given by integer +offset+ ;TI",(see {Position}[rdoc-ref:IO@Position]) ;TI",and constant +whence+, which is one of:;To:RDoc::Markup::BlankLine o:RDoc::Markup::List: @type:BULLET:@items[o:RDoc::Markup::ListItem:@label0; [o; ; [I"&+:CUR+ or <tt>IO::SEEK_CUR</tt>: ;TI"LRepositions the stream to its current position plus the given +offset+:;T@o:RDoc::Markup::Verbatim; [I"f = File.open('t.txt') ;TI"f.tell # => 0 ;TI"f.seek(20, :CUR) # => 0 ;TI"f.tell # => 20 ;TI"f.seek(-10, :CUR) # => 0 ;TI"f.tell # => 10 ;TI" f.close ;T:@format0o;;0; [o; ; [I"&+:END+ or <tt>IO::SEEK_END</tt>: ;TI"?Repositions the stream to its end plus the given +offset+:;T@o;; [I"f = File.open('t.txt') ;TI"f.tell # => 0 ;TI"<f.seek(0, :END) # => 0 # Repositions to stream end. ;TI"f.tell # => 52 ;TI"f.seek(-20, :END) # => 0 ;TI"f.tell # => 32 ;TI"f.seek(-40, :END) # => 0 ;TI"f.tell # => 12 ;TI" f.close ;T;0o;;0; [o; ; [I"%+:SET+ or <tt>IO:SEEK_SET</tt>: ;TI"2Repositions the stream to the given +offset+:;T@o;; [I"f = File.open('t.txt') ;TI"f.tell # => 0 ;TI"f.seek(20, :SET) # => 0 ;TI"f.tell # => 20 ;TI"f.seek(40, :SET) # => 0 ;TI"f.tell # => 40 ;TI" f.close ;T;0o; ; [I"Related: IO#pos=, IO#tell.;T: @fileI" io.c;T:0@omit_headings_from_table_of_contents_below0I".seek(offset, whence = IO::SEEK_SET) -> 0 ;T0[ I"(p1, p2 = v2);T@EFI"IO;TcRDoc::NormalClass00