getc
方法在ruby中做了什么?我找到了这段代码:
class XOREncrypt
def initialize(inputfile, password, outputfile)
input = File.open(inputfile,"r")
pass_array = password.split(//)
output = File.new(outputfile,"w")
i = 0
while c = input.getc
pass_char = pass_array[i]
xor = c.chr[0] ^ pass_char[0]
output.print(xor.chr)
i+=1
if i == (pass_array.size - 1)
i = 0
end
end
input.close
output.close
end
end
puts "Filename for Input : "
inputfile = gets
puts "Insert Password : "
password = gets
puts "Filename for Output : "
outputfile = gets
XOREncrypt.new(inputfile.chomp, password.chomp, outputfile.chomp)
getc
方法在ruby中做了什么?我用Google搜索,但没有结果。