るりまサーチ

最速Rubyリファレンスマニュアル検索!
55件ヒット [1-55件を表示] (0.047秒)
トップページ > クエリ:IO[x] > クエリ:line[x] > クエリ:tell[x]

別のキーワード

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

ライブラリ

クラス

モジュール

キーワード

検索結果

IO#tell -> Integer (36119.0)

ファイルポインタの現在の位置を整数で返します。

...タの現在の位置を整数で返します。

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

//emlist[例][ruby]{
IO
.write("testfile", "This is line one\n")
File.open("testfile") do |f|
f.pos # => 0
f.gets # => "This is line one\n"
f.pos # => 17
end
//}...

IO#pos -> Integer (21019.0)

ファイルポインタの現在の位置を整数で返します。

...タの現在の位置を整数で返します。

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

//emlist[例][ruby]{
IO
.write("testfile", "This is line one\n")
File.open("testfile") do |f|
f.pos # => 0
f.gets # => "This is line one\n"
f.pos # => 17
end
//}...

ARGF.class#tell -> Integer (15125.0)

ARGFが現在開いているファイルのファイルポインタの現在の位置をバイト単位 の整数で返します。

...ARGFが現在開いているファイルのファイルポインタの現在の位置をバイト単位
の整数で返します。

ARGF.pos # => 0
ARGF.gets # => "This is line one\n"
ARGF.pos # => 17

@see IO#pos, IO#tell, ARGF.class#pos=...

ARGF.class#pos -> Integer (25.0)

ARGFが現在開いているファイルのファイルポインタの現在の位置をバイト単位 の整数で返します。

...ARGFが現在開いているファイルのファイルポインタの現在の位置をバイト単位
の整数で返します。

ARGF.pos # => 0
ARGF.gets # => "This is line one\n"
ARGF.pos # => 17

@see IO#pos, IO#tell, ARGF.class#pos=...

Kernel$$stdin -> object (24.0)

標準入力です。

...クトが以下のメソッドを
正しく実装していなければいけません。

gets, readline, readlines, getc, readchar, tell, seek,
pos=, rewind, fileno, to_io, eof, each_line, each_byte,
binmode, closed?

//emlist[例][ruby]{
$stdin = Object.new
def $stdin.gets
"foo"
end...
...p gets() # => "foo"
//}

自プロセスだけでなく、子プロセスの標準入力もリダイレクトしたいときは
以下のように IO#reopen を使います。

//emlist[例][ruby]{
$stdin.reopen("/tmp/foo")
//}

また、リダイレクトしたあと
出力先をまた元に戻し...

絞り込み条件を変える