On Sun, 1 May 2005, Jeff Singer wrote: > I am still fairly new to ruby, and have been working on a fairly small > project. > Ive looked through the online book on ruby central, Why's Poignant > guide, and the ruby-doc documentation on both File and IO, but I still > can't get the program to work. > Im trying ouput an array containing binary data to a file, the code is: > > 176: filename = gets > 177: aFile = File.new(filename, 'w') > 178: @file.each {|element| aFile.print element} > 179: aFile.close > > @file is an array of bytes, broken into blocks of 500 that Id like to > send to the file that Im prompted for. > And those numbers aren't actually there, as they are the line numbers. guess you figured out the 'gets.chomp' bit (though i'd actually do gets.strip since a leading space would hose you too). assuming you meant 500 __bytes__ you can output the entire array at once using: File::new(filename, 'wb'){|f| f.write(@file.join.pack)} -a -- =============================================================================== | email :: ara [dot] t [dot] howard [at] noaa [dot] gov | phone :: 303.497.6469 | renunciation is not getting rid of the things of this world, but accepting | that they pass away. --aitken roshi ===============================================================================