Skip to content

Instantly share code, notes, and snippets.

@sms420
Created August 26, 2009 00:28
Show Gist options
  • Select an option

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

Select an option

Save sms420/175159 to your computer and use it in GitHub Desktop.
# read_write.rb
file_A = File.new("parent.txt", "r+")
file_B = File.new("child.txt", "r+")
file_C = File.new("out.txt", "r+")
while (line_A = file_A.gets)
line_B = file_B.gets
if (line_A == line_B)
file_C.puts "#{line_A}"
else
file_C.puts "poop"
end
end
file_A.close
file_B.close
file_C.close
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment