刚接触LUA,学习IO库的写法,但是路径出错问题
lua吧
全部回复
仅看楼主
level 5
xywliao 楼主
IO库里的
io.input
io.output
io.read
io.write
有这几个读写文件的命令,
问题是在编译器中运行io.input("C:\Users\Administrator\Desktop\xy.txt")
这个报错了,
真心不懂这个文件路径的写法,能指点一下吗?
要读取这个路径里的TXT里面所有内容怎样写代码
io.intpu("C:\Users\Administrator\Desktop\xy.txt")
io.read()
后面print不知怎样写在输出窗口将TXT里的内容输出来,
请问怎样写
2015年10月26日 09点10分 1
level 11
fp=io.open(",,地址,,","r")
储存的变量=fp:read("all")
2015年10月27日 02点10分 2
这,号什么意思?
2015年10月27日 05点10分
@xywliao 你这地址我换成的决对路径,还是不对 fp=io.open(",,C:\Users\Administrator\Desktop\xy.txt,,","r") a=fp:read("all") print (a)
2015年10月27日 05点10分
level 5
xywliao 楼主
local a
fp=io.open(",,C:\Users\Administrator\Desktop\xy.txt,,","r")
a=fp:read("all")
print (a)
这样写报错了我的路劲是:C:\Users\Administrator\Desktop\xy.txt
卓面的一个TXT
2015年10月27日 05点10分 4
level 5
xywliao 楼主
不懂这参数是怎样写的啊,
e:\lua教程\adf.lua:4: bad argument #1 to 'input' (xy.txt: No such file or directory)
怎样写都报错
2015年10月27日 06点10分 5
1