def self.createpuhash(f) f.gsub!(/\//,"\\\") ATT::KeyLog::info "The current file is #{f}" File.open("c:\\太原移动\\data\\x_O-x.dat".to_gbk) do |s| ATT::KeyLog::info "The current file is #{s}" s.each_line do |line| ......
File.open 路径怎样传都不对,报告没有这个文件,该如何处理,麻烦帮忙,谢谢。
irb(main):006:0> t = File.open("c:\太原移动\data\x_O-x.dat") => #Filedatax_O-x.dat太原移动 irb(main):007:0> t.close
//有用#encoding:utf-8 ATT::KeyLog::info "#{f}" f.gsub!(/\//,"\\\\") ATT::KeyLog::info "The current file is #{f}" #"c:\\太原移动\\data\\x_O-x.dat" #试了下直接这样是可以的 File.open("#{f}".to_gbk) do |s| ATT::KeyLog::info "The current file is #{s}"