るりまサーチ

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

別のキーワード

  1. entity ref
  2. fiddle ref
  3. pointer ref
  4. _builtin _id2ref
  5. rexml/document ref

ライブラリ

クラス

キーワード

検索結果

IO#binmode -> self (18137.0)

ストリームをバイナリモードにします。MSDOS などバイナリモードの存在 する OS でのみ有効です。そうでない場合このメソッドは何もしません。

...ンしかありません。

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

//emlist[例][ruby]{
IO.open(IO.sysopen("testfile", "w+")) do |io|
io.binmode? # => false
io.binmode # => #<IO:fd 8>
io.binmode? # => true
end
//}

@see c:IO#io_binmode, IO#binmode?...

IO#binmode? -> bool (6119.0)

自身がバイナリモードなら true を返します。そうでない場合、false を返します。

...自身がバイナリモードなら true を返します。そうでない場合、false を返します。


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

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

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

...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(' ')
# => 89 50 4e 47 0d 0a 1a 0a 00 00 00 0d 49 48 44 52

# binwriteを...
....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...

IO (12.0)

基本的な入出力機能のためのクラスです。

...が返すファイル名のエンコーディングも同様にプラットフォーム依存です。
UNIX では ASCII-8BIT です。

====[a:io_binmode] バイナリモード

Windows の IO にはテキストモードとバイナリモードという2種類のモードが存在します。
...