Commit b798580f authored by funshine's avatar funshine
Browse files

6 channel pwm, add file.seek()

parent ffd2e9c3
This diff is collapsed.
...@@ -2,6 +2,10 @@ ...@@ -2,6 +2,10 @@
###version 0.2 2014-11-10 ###version 0.2 2014-11-10
###change log: ###change log:
2014-11-11<br />
add file.seek() api to file module<br />
now max 6 pwm channel is supported<br />
2014-11-10<br /> 2014-11-10<br />
change log module to file module<br /> change log module to file module<br />
now file operation support multiple read/write<br /> now file operation support multiple read/write<br />
...@@ -411,6 +415,42 @@ nil ...@@ -411,6 +415,42 @@ nil
**-** [file.open()](#fl_open)<br /> **-** [file.open()](#fl_open)<br />
**-** [file.writeline()](#fl_writeline) **-** [file.writeline()](#fl_writeline)
<a id="fl_seek"></a>
## file.seek()
####Description
Sets and gets the file position, measured from the beginning of the file, to the position given by offset plus a base specified by the string whence.
####Syntax
file.seek(whence, offset)
####Parameters
whence:<br />
"set": base is position 0 (beginning of the file);<br />
"cur": base is current position;(default value)<br />
"end": base is end of file;<br />
offset: default 0
####Returns
success: returns the final file position<br />
fail: returns nil
####Example
```
-- open 'init.lua' in 'a+' mode
file.open("init.lua", "a+")
-- write 'foo bar' to the end of the file
file.write('foo bar')
file.flush()
file.seek("set")
print(file.readline())
file.close()
```
####See also
**-** [file.open()](#fl_open)<br />
**-** [file.writeline()](#fl_writeline)
<a id="fl_list"></a> <a id="fl_list"></a>
## file.list() ## file.list()
####Description ####Description
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment