るりまサーチ

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

別のキーワード

  1. openssl integer
  2. asn1 integer
  3. _builtin integer
  4. integer upto
  5. integer times

ライブラリ

クラス

キーワード

検索結果

<< 1 2 > >>

IO.write(path, string, **opts) -> Integer (18223.0)

path で指定されるファイルを開き、string を書き込み、 閉じます。

...s line two\nThis is line three\nAnd so on...\n"
IO.write("testfile", text) # => 66
IO.write("testfile", "0123456789", 20) #=> 10
IO.read("testfile")
# => "This is line one\nThi0123456789two\nThis is line three\nAnd so on...\n"
IO.write("testfile", "0123456789") #=> 10
IO.read("tes...
...tfile") # => "0123456789"
//}

@see IO.binwrite...

IO.write(path, string, offset=nil, **opts) -> Integer (18223.0)

path で指定されるファイルを開き、string を書き込み、 閉じます。

...s line two\nThis is line three\nAnd so on...\n"
IO.write("testfile", text) # => 66
IO.write("testfile", "0123456789", 20) #=> 10
IO.read("testfile")
# => "This is line one\nThi0123456789two\nThis is line three\nAnd so on...\n"
IO.write("testfile", "0123456789") #=> 10
IO.read("tes...
...tfile") # => "0123456789"
//}

@see IO.binwrite...

IO.binwrite(path, string, offset=nil) -> Integer (6220.0)

path で指定されるファイルを開き、string を書き込み、 閉じます。

...き込み、
閉じます。

ファイルを開くときの mode が "rb:ASCII-8BIT" で、バイナリモードが有効
である点以外は IO.write と同じです。

Kernel.#open と同様 path の先頭が "|" ならば、"|" に続くコマンドを実行し、コマンドの出力を標...
...49 48 44 52

# binwriteを使用した場合: どの環境でも正しく保存できる。
IO.binwrite('white.binmode.png', png)
puts IO.binread('white.binmode.png', 16).unpack('C*').map {|c| '%02x' % c }.join(' ')
# => 89 50 4e 47 0d 0a 1a 0a 00 00 00 0d 49 48 44 52

# binwriteを使用しなか...
...O.write('white.txtmode.png', png)
puts IO.binread('white.txtmode.png', 16).unpack('C*').map {|c| '%02x' % c }.join(' ')
# => 89 50 4e 47 0d 0a 1a 0a 00 00 00 0d 49 48 44 52 (Linux/Macの場合
# => 89 50 4e 47 0d 0d 0a 1a 0d 0a 00 00 00 0d 49 48 (Windowsの場合
//}

@see c:IO#io_binmode, IO.write...

File.delete(*filename) -> Integer (109.0)

ファイルを削除します。削除したファイルの数を返します。 削除に失敗した場合は例外 Errno::EXXX が発生します。

...ilename ファイル名を表す文字列を指定します。

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

//emlist[例][ruby]{
IO.write("test.txt", "test")
p File.exist?("test.txt") # => true
p File.delete("test.txt") # => 1
p File.exist?("test.txt") # => false
begin
File.del...

File.unlink(*filename) -> Integer (109.0)

ファイルを削除します。削除したファイルの数を返します。 削除に失敗した場合は例外 Errno::EXXX が発生します。

...ilename ファイル名を表す文字列を指定します。

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

//emlist[例][ruby]{
IO.write("test.txt", "test")
p File.exist?("test.txt") # => true
p File.delete("test.txt") # => 1
p File.exist?("test.txt") # => false
begin
File.del...

絞り込み条件を変える

IO.copy_stream(src, dst, copy_length = nil) -> Integer (109.0)

指定された src から dst へコピーします。 コピーしたバイト数を返します。

...さに制限はありません。

@param src_offset コピーを始めるオフセットを数値で指定します。

//emlist[例][ruby]{
IO.write("filetest", "abcdefghij")
IO.copy_stream("filetest", "filecopy", 2) # => 2
IO.read("filecopy") # => "ab"
IO.copy_strea...

IO.copy_stream(src, dst, copy_length, src_offset) -> Integer (109.0)

指定された src から dst へコピーします。 コピーしたバイト数を返します。

...さに制限はありません。

@param src_offset コピーを始めるオフセットを数値で指定します。

//emlist[例][ruby]{
IO.write("filetest", "abcdefghij")
IO.copy_stream("filetest", "filecopy", 2) # => 2
IO.read("filecopy") # => "ab"
IO.copy_strea...

File.chown(owner, group, *filename) -> Integer (108.0)

ファイルのオーナーとグループを変更します。スーパーユーザだけがファ イルのオーナーとグループを変更できます。変更を行ったファイルの数を 返します。

...を指定することで、グループを現在のままにすることができます。

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

//emlist[例][ruby]{
IO.write("test.txt", "test")
File.chown(502, 12, "test.txt")
File.stat("test.txt").uid # => 502
//}

@see File#chown...

File.lchmod(mode, *filename) -> Integer (108.0)

File.chmod と同様ですが、シンボリックリンクに関してリンクそのものの モードを変更します。

...ドを呼び出すと発生します。

@raise Errno::EXXX モードの変更に失敗した場合に発生します。

//emlist[例][ruby]{
IO.write("testfile", "test")
File.symlink("testfile", "testlink")
File.lstat("testlink").ftype # => "link"
File.lchmod(0744, "testlink")
File.stat...
<< 1 2 > >>