RosettaCodeData/Task/Fixed-length-records/Ruby/fixed-length-records.rb

8 lines
186 B
Ruby
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
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