我正在使用以下程序复制另一个文件。我经常看到源和目标不完全相同(md5sum不同)。下面的代码有什么问题吗?LUA副本问题
local size = 2^13 -- good buffer size (8K)
local params = {...}
local srcfile = params[1]
local outfile = params[1] .. "_copy"
print (srcfile)
print (outfile)
local inf = io.open(srcfile, "r")
local of = io.open(outfile, "w")
while true do
local block = inf:read(size)
print(size)
if not block then break end
of:write(block)
end
inf:close()
of:close()
感谢, GL
放弃循环,只使用'of:write(inf:read(“* a”))''。 – lhf