From: Alexis Alulema Date: 2009-09-05T00:26:44+09:00 Subject: Re: write byte array to file Hi all, sorry to reopen this issue, I'm facing something weird trying to reaseemble a binary stream to file. I tried the same code you are using here: File.open('E:\\UpdatePackage\\Materials\\coco2.jpg', 'w' ) do |output| a.each do | byte | output.print byte.chr end end print File.size('E:\\UpdatePackage\\Materials\\coco2.jpg'), "\n" # out 1190386 print a.length, "\n" # out 1185939 which is supposed to work fine, BUT the reaasembled file is not valid and is not the same length in bytes than the array length: array 'a' length: 1185939 new file length: 1190386 For me, this is weird b/c i'm passing exactly all those 1185939 bytes to file, but the new file is 1190386. Any idea? Thanks in advance Rajesh Olafson wrote: > Thank you Robert. it work now. > Rajesh. > > On Thu, Jun 12, 2008 at 3:51 AM, Robert Dober -- Posted via http://www.ruby-forum.com/.