るりまサーチ

最速Rubyリファレンスマニュアル検索!
246件ヒット [201-246件を表示] (0.080秒)

別のキーワード

  1. _builtin file?
  2. _builtin file
  3. file open
  4. file path
  5. file size

ライブラリ

クラス

キーワード

検索結果

<< < 1 2 3 >>

IO#tty? -> bool (19.0)

入出力ポートがttyに結合している時、真を返します。そうでない場合 false を返します。

...入出力ポートがttyに結合している時、真を返します。そうでない場合 false を返します。

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

//emlist[例][ruby]{
File
.new("testfile").isatty # => false
File
.new("/dev/tty").isatty # => true
//}...

IO#close_on_exec=(bool) (13.0)

自身に close-on-exec フラグを設定します。

...2)
@param bool 自身の close-on-exec フラグを true か false で指定します。

f = open("/dev/null")
f.close_on_exec = true
system("cat", "/proc/self/fd/#{f.fileno}") # cat: /proc/self/fd/3: No such file or directory
f.closed? #=> false

@see IO#close_on_exec?...

IO#read(length = nil, outbuf = "") -> String | nil (13.0)

length バイト読み込んで、その文字列を返します。

...負の場合に発生します。

第二引数を指定した read の呼び出しでデータが空であった場合
(read が nil を返す場合)、outbuf は空文字列になります。

outbuf = "x" * 20;
io = File.open("/dev/null")
p io.read(10,outbuf)
p outbuf
=> nil
""...

IO#sysread(maxlen, outbuf = "") -> String (13.0)

read(2) を用いて入力を行ない、入力されたデータを 含む文字列を返します。stdio を経由しないので gets や getc や eof? などと混用すると思わぬ動作 をすることがあります。

...数を指定した sysread の呼び出しでデータが空であった場
合(sysread が例外 EOFError を発生させる場合)、
outbuf は空文字列になります。

outbuf = "x" * 20;
io = File.open("/dev/null")
p((io.sysread(10,outbuf) rescue nil))
p outbuf
=> nil
""...
<< < 1 2 3 >>