るりまサーチ (Ruby 2.2.0)

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

別のキーワード

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

ライブラリ

クラス

検索結果

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

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

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

Kernel.#open と同様 path の先頭が "|" ならば、"|" に続くコマンドの出力を読み取ります。

length を省略するとファイルの末尾まで読み込みます。

ファイルを開くときの mode は "rb:ASCII-8BIT" です。

//emlist[例][ruby]{
IO.write("testfile", "This is line one\nThis is line two\nThis is line three\nAnd so on......

Pathname#binread(*args) -> String | nil (54508.0)

IO.binread(self.to_s, *args)と同じです。

IO.binread(self.to_s, *args)と同じです。

//emlist[例][ruby]{
require "pathname"

pathname = Pathname("testfile")
pathname.binread # => "This is line one\nThis is line two\nThis is line three\nAnd so on...\n"
pathname.binread(20) # => "This is line one\nThi"
pathname.binread(20, 10) # => ...