55件ヒット
[1-55件を表示]
(0.048秒)
検索結果
先頭5件
-
IO
# reopen(path) -> self (24227.0) -
path で指定されたファイルにストリームを繋ぎ換えます。
...print("This is line three\n")
f2.readlines # => ["This is line one\n", "This is line two\n"]
f1.close
f2.reopen("testfile", "r") # => #<File:testfile>
f2.readlines # => ["This is line one\n", "This is line two\n", "This is line three\n"]
f2.close
//}
@see Kernel.#open... -
IO
# reopen(path , mode) -> self (24227.0) -
path で指定されたファイルにストリームを繋ぎ換えます。
...print("This is line three\n")
f2.readlines # => ["This is line one\n", "This is line two\n"]
f1.close
f2.reopen("testfile", "r") # => #<File:testfile>
f2.readlines # => ["This is line one\n", "This is line two\n", "This is line three\n"]
f2.close
//}
@see Kernel.#open... -
IO
# reopen(io) -> self (24207.0) -
自身を指定された io に繋ぎ換えます。
自身を指定された io に繋ぎ換えます。
クラスも io に等しくなることに注意してください。
IO#pos, IO#lineno などは指定された io と等しくなります。
@param io 自身を繋ぎ換えたい IO オブジェクトを指定します。
@raise IOError 指定された io が close されている場合に発生します。 -
Kernel
$ $ > -> object (9054.0) -
標準出力です。
...標準出力です。
組み込み関数 Kernel.#print、Kernel.#puts や
Kernel.#p などのデフォルトの出力先となります。
初期値は Object::STDOUT です。
コマンドラインオプションオプション -i を指定した場合には
読み込み元と同じ名前のフ......ut = File.open("/tmp/foo", "w")
puts "foo" # 出力する
$stdout = STDOUT # 元に戻す
//}
自プロセスだけでなく、子プロセスの標準出力もリダイレクトしたいときは
以下のように IO#reopen を使います。
//emlist[例][ruby]{
STDOUT.reopen("/tmp/fo......# 元の $stdout を保存する
$stdout.reopen("/tmp/foo") # $stdout を /tmp/foo にリダイレクトする
puts "foo" # /tmp/foo に出力
$stdout.flush # 念のためフラッシュする
$stdout.reopen stdout_old # 元に戻す
//}
$stdout... -
Kernel
$ $ stdout -> object (9054.0) -
標準出力です。
...標準出力です。
組み込み関数 Kernel.#print、Kernel.#puts や
Kernel.#p などのデフォルトの出力先となります。
初期値は Object::STDOUT です。
コマンドラインオプションオプション -i を指定した場合には
読み込み元と同じ名前のフ......ut = File.open("/tmp/foo", "w")
puts "foo" # 出力する
$stdout = STDOUT # 元に戻す
//}
自プロセスだけでなく、子プロセスの標準出力もリダイレクトしたいときは
以下のように IO#reopen を使います。
//emlist[例][ruby]{
STDOUT.reopen("/tmp/fo......# 元の $stdout を保存する
$stdout.reopen("/tmp/foo") # $stdout を /tmp/foo にリダイレクトする
puts "foo" # /tmp/foo に出力
$stdout.flush # 念のためフラッシュする
$stdout.reopen stdout_old # 元に戻す
//}
$stdout...