closes a file
flushes outstanding data to disk for the default output file
opens filename for input in text mode
returns an iterator function for reading a named file line-by-line
file = io.open (filename [, mode])
mode
opens a file for output
creates a pipe and executes a command
reads from the default input file
returns a handle to a temporary file
returns type of file handle
writes to the default output file
closes a file
向文件写入缓冲中的所有数据
returns an iterator function for reading the file line-by-line
reads the file according to the specified formats
设置和获取当前文件位置,成功则返回最终的文件位置(按字节)
参数 whence 值可以是:
"set": 从文件头开始
"cur": 从当前位置开始[默认]
"end": 从文件尾开始
offset:默认为0
不带参数file:seek()则返回当前位置,file:seek("set")则定位到文件头,file:seek("end")则定位到文件尾并返回文件大小
sets the buffering mode for an output file
writes to a file
Deletes a file
Renames a file
Returns a name for a temporary file