Skip to content

Instantly share code, notes, and snippets.

@sms420
Created August 11, 2009 01:01
Show Gist options
  • Select an option

  • Save sms420/165543 to your computer and use it in GitHub Desktop.

Select an option

Save sms420/165543 to your computer and use it in GitHub Desktop.
# read_write.rb
# reads from input file
# writes to output file
# printing line nums
counter = 1
outFile = File.new("output.txt", "w")
inFile = File.new("input.txt", "r")
while (line = inFile.gets)
outFile.puts "#{counter}: #{line}"
counter = counter + 1
End
inFile.close
outFile.close
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment