lua中的io
来源:互联网 发布:玄空飞星软件下载 编辑:程序博客网 时间:2024/05/18 03:46
--[[ Lua中的IO模型 1、了解模型中的read和write 2、IO库复杂模型的性能小诀窍 读取二进制文件(就是在原来的基础上加b) local f = assert(io.open("ok.txt",'rb'))--local m = require("io")--m.write("ok\n")io.write("ok\n")io.write("sin(3)= ",math.sin(3),"\n")io.write(string.format ("sin(3) = %6f\n",math.sin(3)))--*all 表示读取整个文件--*line 表示读取下一行--*number 表示读取一个数字--<num> 表示读取一个不超过num个的字符的字符串 有点问题--tt = io.read("*all") --print(tt)local f = assert(io.open("ok.txt",'r'))local m = f:read("*all")f:close() --注意别忘了print(m)]]local f = assert(io.open("ok.txt",'r'))--local t = f:read("*all")local BufferSize = 2^13 --8kf:read(BufferSize, "*line") -- 提高性能f:close()function my_write(message) local file = assert(io.open("ok.txt",'a')) file:write(message) file:close()endmy_write("Hello liuyongtao")function write_other(msg) local file = assert(io.open("a.txt","a")) local temp =io.input() file:input("newinput.txt") file:write(msg) io.input():close() io.input( file ) end
0 0
- Lua中的IO库
- lua中的io
- lua io
- [Lua]Lua IO库整理
- [Lua]Lua IO库整理
- lua io的操作
- lua 写文件io
- LUA IO库
- lua io详细操作
- Lua的IO操作
- lua io详细操作
- Lua io string lib
- lua 文件io操作方法
- lua io库 操作
- lua -- io.pathinfo
- lua io函数
- Lua IO文件copy
- Lua IO库详解
- iPhone之为UIView设置阴影(CALayer的shadowColor,shadowOffset,shadowOpacity,shadowRadius,shadowPath属性)
- Java InputStream层次分析
- 内存分配、释放以及内存分配系统调用
- 1051. Pop Sequence
- Fragment实现Tab
- lua中的io
- Hadoop学习之MapReduce框架
- 如何使用devstack配置openstack(单节点)
- mysql数据恢复(通过日志)
- LeetCode- Bit Manipulation LeetCode总结(1) —— 位运算
- HDU 5294 Tricks Device(最短路+最小割)
- HTTP Content-type整理
- The constructor Intent(new View.OnClickListener(){}, Class<ButtonStudyActivity>) is undefined
- 图片点击放大左右切换