C
Carl Youngblood
Hi, I'm trying to embed a binary file inside a ruby script but I'm
having trouble. To test it out, I wrote a simple script that will take
a binary file and encode it to base64 and then decode it again and write
out the result. Here it is:
require 'base64'
bindata = File.open('oldbinfile').read
File.open('newbinfile', 'w') do |f|
f.write decode64(encode64(bindata))
end
When I run this, newbinfile is not identical to oldbinfile anymore.
Anyone know what I'm doing wrong? I'm assuming that the File IO
functions are not binary safe, but what should I use instead?
Thanks,
Carl Youngblood
having trouble. To test it out, I wrote a simple script that will take
a binary file and encode it to base64 and then decode it again and write
out the result. Here it is:
require 'base64'
bindata = File.open('oldbinfile').read
File.open('newbinfile', 'w') do |f|
f.write decode64(encode64(bindata))
end
When I run this, newbinfile is not identical to oldbinfile anymore.
Anyone know what I'm doing wrong? I'm assuming that the File IO
functions are not binary safe, but what should I use instead?
Thanks,
Carl Youngblood