Posted: Wed Apr 09, 2008 5:09 am Post subject: Re: File IO?
Ruby:
File.open("enter_file_name", "r+")do |file|
file.puts("This goes in the file!")
file.puts("This also goes to the file!")
lines = file.read# Enitre file added to lines
lines.each_linedo |l|
puts l[7] + ' ' + l[4] + ' '# Print the 5th and 8th character of each line end
end