rubyファイル操作時の疑惑

680 ワード


puts '         :'
fileImp = STDIN.gets   

logfile = File.new('temp.txt','a')
File.open(fileImp)do|file|
  
  until file.eof?
   logfile.puts file.gets.strip.gsub(/[\s]/,',')
  end  

  logfile.close
end

以上のコードを実行
----------------------------
解析するファイル名を入力:
2.txt
----------------------------
エラーメッセージ:
test.rb:5:in `initialize': Invalid argument - 2.txt (Errno::EINVAL)
from test.rb:5:in `open'
from test.rb:5
ファイルを開けた時に死んでしまったら問題ありません
File.open('2.txt')
どなたか説明していただけませんか.