るりまサーチ

最速Rubyリファレンスマニュアル検索!
61件ヒット [1-61件を表示] (0.053秒)
トップページ > クエリ:|[x] > クエリ:-[x] > クエリ:binwrite[x]

別のキーワード

  1. _builtin |
  2. ipaddr |
  3. set |
  4. integer |
  5. nilclass |

種類

ライブラリ

クラス

キーワード

検索結果

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

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

...み、
閉じます。

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

Kernel.#open と同様 path の先頭が "|" ならば、"|" に続くコマンドを実行し、コマンドの出力を標準出...
...].unpack('C*').map {|c| '%02x' % c }.join(' ')
# => 89 50 4e 47 0d 0a 1a 0a 00 00 00 0d 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('...
...0d 0a 1a 0a 00 00 00 0d 49 48 44 52

# binwriteを使用しなかった場合: Windowsで改行文字(0x0a: "\n")と同じビット列が変換されてしまう。
IO.write('white.txtmode.png', png)
puts IO.binread('white.txtmode.png', 16).unpack('C*').map {|c| '%02x' % c }.join(' ')
# => 89 50 4e...

IO.open(fd, mode = "r", **opts) {|io| ... } -> object (219.0)

オープン済みのファイルディスクリプタ fd に対する新しい IO オブジェクトを生成して返します。

...数と同じ意味です
* :external_encoding 外部エンコーディング。"-" はデフォルト外部エンコーディングの
別名です。
* :internal_encoding 内部エンコーディング。"-" はデフォルト内部エンコーディングの
別名です。nilなら変...
...IO.binwrite("testfile", "\xBF\xAA\x16\x04.\b\xCB\x12\xACoeQ\xFDv2\xCF9+\x81\x18")
io = IO.for_fd(IO.sysopen("testfile"), "r", binmode: true)
io.class # => IO
io.binmode? # => true
io.close
//}

//emlist[例:IO.open によるファイルオープン][ruby]{
IO.open(IO.sysopen("testfile")) { |io| p i...

IO.for_fd(fd, mode = "r", **opts) -> IO (119.0)

オープン済みのファイルディスクリプタ fd に対する新しい IO オブジェクトを生成して返します。

...数と同じ意味です
* :external_encoding 外部エンコーディング。"-" はデフォルト外部エンコーディングの
別名です。
* :internal_encoding 内部エンコーディング。"-" はデフォルト内部エンコーディングの
別名です。nilなら変...
...IO.binwrite("testfile", "\xBF\xAA\x16\x04.\b\xCB\x12\xACoeQ\xFDv2\xCF9+\x81\x18")
io = IO.for_fd(IO.sysopen("testfile"), "r", binmode: true)
io.class # => IO
io.binmode? # => true
io.close
//}

//emlist[例:IO.open によるファイルオープン][ruby]{
IO.open(IO.sysopen("testfile")) { |io| p i...

IO.new(fd, mode = "r", **opts) -> IO (119.0)

オープン済みのファイルディスクリプタ fd に対する新しい IO オブジェクトを生成して返します。

...数と同じ意味です
* :external_encoding 外部エンコーディング。"-" はデフォルト外部エンコーディングの
別名です。
* :internal_encoding 内部エンコーディング。"-" はデフォルト内部エンコーディングの
別名です。nilなら変...
...IO.binwrite("testfile", "\xBF\xAA\x16\x04.\b\xCB\x12\xACoeQ\xFDv2\xCF9+\x81\x18")
io = IO.for_fd(IO.sysopen("testfile"), "r", binmode: true)
io.class # => IO
io.binmode? # => true
io.close
//}

//emlist[例:IO.open によるファイルオープン][ruby]{
IO.open(IO.sysopen("testfile")) { |io| p i...

IO.open(fd, mode = "r", **opts) -> IO (119.0)

オープン済みのファイルディスクリプタ fd に対する新しい IO オブジェクトを生成して返します。

...数と同じ意味です
* :external_encoding 外部エンコーディング。"-" はデフォルト外部エンコーディングの
別名です。
* :internal_encoding 内部エンコーディング。"-" はデフォルト内部エンコーディングの
別名です。nilなら変...
...IO.binwrite("testfile", "\xBF\xAA\x16\x04.\b\xCB\x12\xACoeQ\xFDv2\xCF9+\x81\x18")
io = IO.for_fd(IO.sysopen("testfile"), "r", binmode: true)
io.class # => IO
io.binmode? # => true
io.close
//}

//emlist[例:IO.open によるファイルオープン][ruby]{
IO.open(IO.sysopen("testfile")) { |io| p i...

絞り込み条件を変える

NEWS for Ruby 2.6.0 (96.0)

NEWS for Ruby 2.6.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。

...は参照情報があるため短いです。
十分な情報と共に書かれた全ての変更のリストは ChangeLog ファイルか bugs.ruby-lang.org の issue を参照してください。

== 2.5.0 以降の変更

=== 言語仕様の変更

* $SAFE はプロセスグローバルで扱...
...の通りです:
//emlist{
ary[1..] # ary[1..-1] と同じ
(1...).each {|index| block } # index が 1 から始まる無限ループ
ary.zip(1..) {|elem, index| block } # ary.each.with_index(1) { }
//}
* キーワード引数のハッシュ...
...予定で、
今は警告が出ます。 14643

* File
* File.read, File.binread, File.write, File.binwrite,
File.foreach, File.readlines はパスがパイプ文字 '|' で始まっていても
外部コマンドを実行しなくなりました。 14245

* Object
* Ob...