Simple Sand Samples |
Ruby > バイナリデータをファイルへ書き込む
write-bin.rb
f=open(ARGV[0] , "wb") f.write("\1") f.write("\2") f.write("\3") f.close()
$ python write-bin.py hoge.bin
$ od -tx1 hoge.bin
0000000 01 02 03
0000003
$
$ od -tx1 hoge.bin
0000000 01 02 03
0000003
$
* 確認環境 Debian Linux(Wheezy)