るりまサーチ

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

別のキーワード

  1. exxx new
  2. exxx errno
  3. _builtin exxx
  4. new errno::exxx
  5. send errno::exxx

ライブラリ

キーワード

検索結果

<< 1 2 3 > >>

IO#print(*arg) -> nil (18126.0)

引数を IO ポートに順に出力します。引数を省略した場合は、$_ を出力します。

...引数を IO ポートに順に出力します。引数を省略した場合は、$_ を出力します。

@param arg Kernel.#print と同じです。

@raise IOError 自身が書き込み用にオープンされていなければ発生します。

@raise Errno::EXXX 出力に失敗した場合...
...に発生します。

//emlist[例][ruby]{
$stdout.print("This is ", 100, " percent.\n") # => This is 100 percent.
//}

@see Kernel.#print...

IO#printf(format, *arg) -> nil (6113.0)

C 言語の printf と同じように、format に従い引数 を文字列に変換して、self に出力します。

... printf と同じように、format に従い引数
を文字列に変換して、self に出力します。

第一引数に IO を指定できないこと、引数を省略できないことを除けば Kernel.#printf と同じです。

@param format Kernel.#printf と同じです。print_form...
...at を参照してください。

@param arg Kernel.#printf と同じです。

@raise IOError 自身が書き込み用にオープンされていなければ発生します。

@raise Errno::EXXX 出力に失敗した場合に発生します。


@see Kernel.#printf...

IO.foreach(path, rs = $/, chomp: false) -> Enumerator (19.0)

path で指定されたファイルの各行を引数としてブロックを繰り返し実行します。 path のオープンに成功すれば nil を返します。

...す。

@raise Errno::EXXX path のオープンに失敗した場合、発生します。

//emlist[例:rs 指定なし][ruby]{
IO
.write("testfile", "line1\nline2,\nline3\n")
IO
.foreach("testfile") # => #<Enumerator: IO:foreach("testfile")>
IO
.foreach("testfile") { |x| print "GOT ", x }
# => GOT li...
...]{
IO
.write("testfile", "line1,line2,line3")
IO
.foreach("testfile", ",") { |x| puts "GOT #{x}" }
# => GOT line1,
# GOT line2,
# GOT line3
//}

//emlist[例: 各行の末尾から "\n", "\r", または "\r\n" を取り除く(chomp = true)][ruby]{
IO
.write("testfile", "line1\nline2,\nline3\n")
IO
....
...foreach("testfile", chomp: true) { |x| print "GOT ", x }
# => GOT line1GOT line2,GOT line3
//}

@see $/...

IO.foreach(path, rs = $/, chomp: false) {|line| ... } -> nil (19.0)

path で指定されたファイルの各行を引数としてブロックを繰り返し実行します。 path のオープンに成功すれば nil を返します。

...す。

@raise Errno::EXXX path のオープンに失敗した場合、発生します。

//emlist[例:rs 指定なし][ruby]{
IO
.write("testfile", "line1\nline2,\nline3\n")
IO
.foreach("testfile") # => #<Enumerator: IO:foreach("testfile")>
IO
.foreach("testfile") { |x| print "GOT ", x }
# => GOT li...
...]{
IO
.write("testfile", "line1,line2,line3")
IO
.foreach("testfile", ",") { |x| puts "GOT #{x}" }
# => GOT line1,
# GOT line2,
# GOT line3
//}

//emlist[例: 各行の末尾から "\n", "\r", または "\r\n" を取り除く(chomp = true)][ruby]{
IO
.write("testfile", "line1\nline2,\nline3\n")
IO
....
...foreach("testfile", chomp: true) { |x| print "GOT ", x }
# => GOT line1GOT line2,GOT line3
//}

@see $/...

IO.popen("-", mode = "r", opt={}) -> IO (14.0)

第一引数に文字列 "-" が指定された時、fork(2) を 行い子プロセスの標準入出力との間にパイプラインを確立します。 親プロセスでは IO オブジェクトを返し、子プロセスでは nil を返します。

...親プロセスでは IO オブジェクトを返し、子プロセスでは
nil を返します。

io
= IO.popen("-", "r+")
if io # parent
io
.puts "foo"
p io.gets # => "child output: foo\n"
io
.close
else # child
s = gets
print
"child output: " + s...
... IO オブジェクトを引数に
ブロックを実行し、その結果を返します。ブロックの実行後、生成したパイ
プは自動的にクローズされます。
子プロセスでは nil を引数にブロックを実行し終了します。

p IO.popen("-", "r+") {|io|...
...します。
@param mode オープンする IO ポートのモードを指定します。mode の詳細は Kernel.#open 参照して下さい。
@param opt エンコーディングなどを設定するオプション引数(see IO.new)

@raise Errno::EXXX パイプ、あるいは子プロセスの生...

絞り込み条件を変える

IO.popen("-", mode = "r", opt={}) {|io| ... } -> object (14.0)

第一引数に文字列 "-" が指定された時、fork(2) を 行い子プロセスの標準入出力との間にパイプラインを確立します。 親プロセスでは IO オブジェクトを返し、子プロセスでは nil を返します。

...親プロセスでは IO オブジェクトを返し、子プロセスでは
nil を返します。

io
= IO.popen("-", "r+")
if io # parent
io
.puts "foo"
p io.gets # => "child output: foo\n"
io
.close
else # child
s = gets
print
"child output: " + s...
... IO オブジェクトを引数に
ブロックを実行し、その結果を返します。ブロックの実行後、生成したパイ
プは自動的にクローズされます。
子プロセスでは nil を引数にブロックを実行し終了します。

p IO.popen("-", "r+") {|io|...
...します。
@param mode オープンする IO ポートのモードを指定します。mode の詳細は Kernel.#open 参照して下さい。
@param opt エンコーディングなどを設定するオプション引数(see IO.new)

@raise Errno::EXXX パイプ、あるいは子プロセスの生...

IO.popen(env, "-", mode = "r", opt={}) -> IO (14.0)

第一引数に文字列 "-" が指定された時、fork(2) を 行い子プロセスの標準入出力との間にパイプラインを確立します。 親プロセスでは IO オブジェクトを返し、子プロセスでは nil を返します。

...親プロセスでは IO オブジェクトを返し、子プロセスでは
nil を返します。

io
= IO.popen("-", "r+")
if io # parent
io
.puts "foo"
p io.gets # => "child output: foo\n"
io
.close
else # child
s = gets
print
"child output: " + s...
... IO オブジェクトを引数に
ブロックを実行し、その結果を返します。ブロックの実行後、生成したパイ
プは自動的にクローズされます。
子プロセスでは nil を引数にブロックを実行し終了します。

p IO.popen("-", "r+") {|io|...
...します。
@param mode オープンする IO ポートのモードを指定します。mode の詳細は Kernel.#open 参照して下さい。
@param opt エンコーディングなどを設定するオプション引数(see IO.new)

@raise Errno::EXXX パイプ、あるいは子プロセスの生...

IO.popen(env, "-", mode = "r", opt={}) {|io| ... } -> object (14.0)

第一引数に文字列 "-" が指定された時、fork(2) を 行い子プロセスの標準入出力との間にパイプラインを確立します。 親プロセスでは IO オブジェクトを返し、子プロセスでは nil を返します。

...親プロセスでは IO オブジェクトを返し、子プロセスでは
nil を返します。

io
= IO.popen("-", "r+")
if io # parent
io
.puts "foo"
p io.gets # => "child output: foo\n"
io
.close
else # child
s = gets
print
"child output: " + s...
... IO オブジェクトを引数に
ブロックを実行し、その結果を返します。ブロックの実行後、生成したパイ
プは自動的にクローズされます。
子プロセスでは nil を引数にブロックを実行し終了します。

p IO.popen("-", "r+") {|io|...
...します。
@param mode オープンする IO ポートのモードを指定します。mode の詳細は Kernel.#open 参照して下さい。
@param opt エンコーディングなどを設定するオプション引数(see IO.new)

@raise Errno::EXXX パイプ、あるいは子プロセスの生...

IO#close_write -> nil (13.0)

書き込み用の IO を close します。

... IO を close します。


@raise IOError 自身が書き込み用にオープンされていなければ発生します。

@raise Errno::EXXX close に失敗した場合に発生します。

//emlist[例][ruby]{
f = IO.popen("/bin/sh","r+") do |f|
f.close_write
# f.print "nowhere" # => IOEr...
...ror: not opened for writing
end
//}

@see IO#close, IO#closed?, IO#close_read...
... IO を close します。

既に close されていた場合には単に無視されます。

@raise IOError 自身が書き込み用にオープンされていなければ発生します。

@raise Errno::EXXX close に失敗した場合に発生します。

//emlist[例][ruby]{
f = IO.popen...
...("/bin/sh","r+") do |f|
f.close_write
# f.print "nowhere" # => IOError: not opened for writing
end
//}

@see IO#close, IO#closed?, IO#close_read...

IO#flush -> self (13.0)

IO ポートの内部バッファをフラッシュします。

...
IO
ポートの内部バッファをフラッシュします。

このメソッドを使ったとき、即座にメタデータを更新することは保証されません(特にWindowsで)。
即座にメタデータも更新したいときは IO#fsync を使います。

@raise IOError 自身...
...用にオープンされていなければ発生します。

@raise Errno::EXXX fflush(3) が失敗した場合に発生します。

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

Tempfile.open("testtmpfile") do |f|
f.print "test"
File.read(f.path) # => ""
f.flush
File.read(f.path) # => "test"
e...

絞り込み条件を変える

<< 1 2 3 > >>