Changing the program to work with files

Hi every body

I have a program that is working with Console ( input - output)

I wanted to see if anybody can help me to modify it so that it takes its
input from a file (text) and write its output also to a file (binary)

because I am new to Ruby and I dunnot working with files .

Thank you very much

On Sat, Jun 21, 2008 at 10:29 PM, Alex Mr [email protected] wrote:


Posted via http://www.ruby-forum.com/.

which difference with file i/o and stdio that confuse you?

Hi, Thank you for reply .

May I ask you to help me modify the program to take input form files
instead of Console ?

Can you please modify it for me ? if yes, Can I send the program to you
to do this favor for me ?

Alex Mr wrote:

I wanted to see if anybody can help me to modify it so that it takes its
input from a file (text) and write its output also to a file (binary)

Use the builtin File class.

Just change ARGV values with variables from file. This example do the
work
for 3 params taking them from command or file.

var1= ARGV[0]
var2= ARGV[1]
var3= ARGV[2]

file = ‘where_is_the_file_with_param’

file_with_param =File.new(file,“r”)
param = file_with_param.gets.split(’ ',-1)
file_with_param.close()

var1 ||= param[0]
var2 ||= param[1]
var3 ||= param[2]

2008/6/22 Dave B. [email protected]: