Ascii to binary conversion

Hi all,

I’m trying to read in a file of numbers that are stored as strings and
I want to convert these to binary and save these out as a binary file.
What is an easy way to do this ascii -> binary conversion in Ruby?

Thanks,

  • Khurram

Try Array.pack and String.unpack.

···

On Sat, 2002-08-17 at 14:58, Khurram wrote:

Hi all,

I’m trying to read in a file of numbers that are stored as strings and
I want to convert these to binary and save these out as a binary file.
What is an easy way to do this ascii -> binary conversion in Ruby?

DNA Research Group mailto:flifson@cs.uct.ac.za
Dept. of Computer Science http://www.cs.uct.ac.za/~flifson
University of Cape Town +27-21-650-3127