files for ex15
This commit is contained in:
parent
675664b042
commit
54d0f0ca26
15
ex15.rb
Normal file
15
ex15.rb
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
filename = ARGV.first
|
||||||
|
|
||||||
|
prompt = "> "
|
||||||
|
txt = File.open(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.open(file_again)
|
||||||
|
|
||||||
|
puts txt_again.read()
|
3
ex15_sample.txt
Normal file
3
ex15_sample.txt
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
This is stuff I typed into a file.
|
||||||
|
It is really cool stuff.
|
||||||
|
Lots and lots of fun to have in here.
|
Loading…
Reference in New Issue
Block a user