well i figured it out btw. so for anyone in the future looking to do something similar to the java code above:
#arguments
inFile = ARGV[0]
outFile = ARGV[1]
def foo(infile, outfile)
begin
puts "Opening input file..."
fin = File.open(inFile, "r")
puts "Creating output file..."
fout = File.open(outFile, "w")
puts "Reading from input file and writing to output file..."
str = ins.readlines()
fout.puts str
puts "Closing files..."
fin.close
fout.close
puts "Process complete!"
rescue => err
puts "Exception: #{err}"
err
end
end
foo(inFile, outFile)
takes in 2 files as command line arguments. 1st file being the input file and the second being the output file. then it writes the input to the output file.
happy coding
drjay!
Reputation Points: 12
Solved Threads: 1
Junior Poster in Training
Offline 87 posts
since Nov 2008