RosettaCodeData/Task/Fixed-length-records/Ruby/fixed-length-records.rb
2023-07-01 13:44:08 -04:00

7 lines
186 B
Ruby

open("outfile.dat", "w") do |out_f|
open("infile.dat") do |in_f|
while record = in_f.read(80)
out_f << record.reverse
end
end
end # both files automatically closed