首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 其他开发语言 >

lua怎么diff两个文件并得到返回结果

2013-07-08 
lua如何diff两个文件并得到返回结果 local command diff -w ..tempfile.. ..goldendird os.execut

lua如何diff两个文件并得到返回结果
 local command = "diff -w "..tempfile.." "..goldendir
  d = os.execute(command)

可是这个返回值d并不是diff -w tempfile goldenir的结果,返回的是一个系统执行完的结果,比较依赖于系统,所以这个值不可靠,不是固定不变的,那有什么办法能得这个比较结果的返回值吗?
[解决办法]
print(type(os.execute("dir > 1.txt")))
local f = io.open("1.txt")
for l in f:lines() do
print(l)
end
你可以试一下这个方法吧
直接完成我是没办法 绕个圈 先写下文件再读

热点排行