ファイル I/O
第二引数に指定されたファイルから読んで、第三引数に指定されたファイルに書く
lesson004.rb
実行結果
dummy, source, target = ARGVopen(source, 'r') do |s|
open(target, 'w') do |t|s.each do |line|
t.puts line
endend
end
C:\>ruby c:\study\ruby\chapter003\lesson004.rb dummy c:\study\ruby\chapter001\le
sson003.rb c:\study\ruby\chapter001\test.txtC:\>type c:\study\ruby\chapter001\test.txt
var1 = "Hello";
var2 = "World";
print var1, ", ", var2, "!", "\n";