るりまサーチ

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

別のキーワード

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

ライブラリ

クラス

モジュール

キーワード

検索結果

Shell#out(dev = STDOUT, &block) -> () (18220.0)

Shell#transact を呼び出しその結果を dev に出力します。

...ェクトなどで指定します。

@param block transact 内部で実行するシェルを指定します。


使用例:
require 'shell'
Shell.def_system_command("head")
sh = Shell.new
File
.open("out.txt", "w"){ |fp|
sh.out(fp) {
system("ls", "-l") | head("-n 3")
}
}...

Shell::CommandProcessor#out(dev = STDOUT, &block) -> () (18220.0)

Shell#transact を呼び出しその結果を dev に出力します。

...ェクトなどで指定します。

@param block transact 内部で実行するシェルを指定します。


使用例:
require 'shell'
Shell.def_system_command("head")
sh = Shell.new
File
.open("out.txt", "w"){ |fp|
sh.out(fp) {
system("ls", "-l") | head("-n 3")
}
}...

Shell::Filter#out(dev = STDOUT, &block) -> () (18220.0)

Shell#transact を呼び出しその結果を dev に出力します。

...ェクトなどで指定します。

@param block transact 内部で実行するシェルを指定します。


使用例:
require 'shell'
Shell.def_system_command("head")
sh = Shell.new
File
.open("out.txt", "w"){ |fp|
sh.out(fp) {
system("ls", "-l") | head("-n 3")
}
}...

File#chmod(mode) -> 0 (9013.0)

ファイルのモードを指定された mode に変更します。

...EXXX が発生し
ます。

@param mode chmod(2) と同様に整数で指定します。

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

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

//emlist[例][ruby]{
f = File.new("out", "w");
f.chmod(0644) #=> 0
//}...

Kernel#cpp_command(outfile, opt = "") -> String (201.0)

実際にプリプロセッサを実行する際に使用するコマンドを返します。

...実際にプリプロセッサを実行する際に使用するコマンドを返します。

@param outfile 出力ファイルの名前を指定します。

@param opt プリプロセッサに与える追加のコマンドライン引数を指定します。

@see RbConfig.expand...

絞り込み条件を変える

IO#pread(maxlen, offset, outbuf = "") -> string (113.0)

preadシステムコールを使ってファイルポインタを変更せずに、また現在のファイルポインタに 依存せずにmaxlenバイト読み込みます。

...バイト数を指定します。
@param offset 読み込み開始位置のファイルの先頭からのオフセットを指定します。
@param outbuf データを受け取る String を指定します。

@raise Errno::EXXX シークまたは書き込みが失敗した場合に発生します...
...edError システムコールがサポートされていない OS で発生します。

//emlist[例][ruby]{
File
.write("testfile", "This is line one\nThis is line two\n")
File
.open("testfile") do |f|
p f.read # => "This is line one\nThis is line two\n"
p f.pread(12, 0) # => "This i...

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

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

...ます。
nil が指定された場合、EOF までの全てのデータを読み込んで、その文字列を返します。

@param outbuf 出力用のバッファを文字列で指定します。IO#read は読み込んだ
データをその文字列オブジェクト...
...負の場合に発生します。

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

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

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

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

...に 0 が指定されている場合は、空文字列 "" を返します。

@param maxlen 入力のサイズを整数で指定します。

@param outbuf 出力用のバッファを文字列で指定します。IO#sysread は読み込んだデータを
その文字列オブジェク...
...数を指定した sysread の呼び出しでデータが空であった場
合(sysread が例外 EOFError を発生させる場合)、
out
buf は空文字列になります。

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

Shell::Filter#>(to) -> self (19.0)

toをフィルタの出力とする。 toが, 文字列ならばファイルに, IOオブジェクトであれ ばそれをそのまま出力とする。

...ルに,IOオブジェクトならばそれに出力します。

使用例
require 'shell'
Shell.def_system_command("tail")
sh = Shell.new
sh.transact {
(sh.tail("-n 3") < "/etc/passwd") > File.open("tail.out", "w")
#(sh.tail("-n 3") < "/etc/passwd") > "tail.out" # と同じ.
}...

Shell::Filter#>>(to) -> self (19.0)

toをフィルタに追加する。 toが, 文字列ならばファイルに, IOオブジェクトであれば それをそのまま出力とする。

...IOオブジェクトならばそれに出力します。

使用例
require 'shell'
Shell.def_system_command("tail")
sh = Shell.new
sh.transact {
(sh.tail("-n 3") < "/etc/passwd") >> "tail.out"
#(sh.tail("-n 3") < "/etc/passwd") >> File.open("tail.out", "w") # でも同じ。
}...

絞り込み条件を変える