lots of extra credit this time, so making sure I'm familiar with it
This commit is contained in:
parent
54d0f0ca26
commit
4900d8fb27
18
ex15-ec.rb
Normal file
18
ex15-ec.rb
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
filename = ARGV.first
|
||||||
|
|
||||||
|
prompt = "> "
|
||||||
|
txt = File.new(filename)
|
||||||
|
|
||||||
|
puts "Here's your file: #{filename}"
|
||||||
|
puts txt.read
|
||||||
|
|
||||||
|
puts "I'll also ask you to type it again:"
|
||||||
|
print prompt
|
||||||
|
file_again = STDIN.gets.chomp
|
||||||
|
|
||||||
|
txt_again = File.new(file_again)
|
||||||
|
|
||||||
|
puts txt_again.read
|
||||||
|
|
||||||
|
txt.close
|
||||||
|
txt_again.close
|
Loading…
Reference in New Issue
Block a user