るりまサーチ (Ruby 2.2.0)

最速Rubyリファレンスマニュアル検索!
2件ヒット [1-2件を表示] (0.045秒)
トップページ > バージョン:2.2.0[x] > クエリ:IO[x] > クエリ:on[x] > クエリ:seek[x] > クラス:IO[x]

別のキーワード

  1. io popen
  2. io pipe
  3. io each
  4. io readlines
  5. io each_line

検索結果

IO#seek(offset, whence = IO::SEEK_SET) -> 0 (118183.0)

ファイルポインタを whence の位置から offset だけ移動させます。 offset 位置への移動が成功すれば 0 を返します。

...* IO::SEEK_SET: ファイルの先頭から (デフォルト)
* IO::SEEK_CUR: 現在のファイルポインタから
* IO::SEEK_END: ファイルの末尾から
* IO::SEEK_DATA: offset 以降の次にデータがある位置へ(lseek の man ページ参照。Linux 3.1 以降のみ)
* IO::...
...no::EXXX ファイルポインタの移動に失敗した場合に発生します。

@raise IOError 既に close されていた場合に発生します。

f = File.new("testfile")
f.seek(-13, IO::SEEK_END) #=> 0
f.readline #=> "And so on...\n"

@see IO#sysseek...

IO.binread(path, length = nil, offset = 0) -> String | nil (63178.0)

path で指定したファイルを open し、offset の所まで seek し、 length バイト読み込みます。

...ist[例][ruby]{
IO
.write("testfile", "This is line one\nThis is line two\nThis is line three\nAnd so on...\n")
IO
.binread("testfile") # => "This is line one\nThis is line two\nThis is line three\nAnd so on...\n"
IO
.binread("testfile", 20) # => "This is line one\nThi"
IO
.binread("test...
...file", 20, 10) # => "ne one\nThis is line "
//}

@see IO.read...