Ruby: output not saved to file
- by Sophie
I'm trying to give a file as input, have it changed within the program, and save the result to a file that is output. But the output file is the same as the input file. :/ Total n00b question, but what am I doing wrong?:
puts "Reading Celsius temperature value from data file..."
num = File.read("temperature.dat")
celsius = num.to_i
farenheit = (celsius * 9/5) + 32
puts "Saving result to output file 'faren_temp.out'"
fh = File.new("faren_temp.out", "w")
fh.puts farenheit
fh.close