Write, Bureaucrats, Administrators
4,332
edits
mNo edit summary |
mNo edit summary |
||
Line 296: | Line 296: | ||
<source lang="javascript" line> | <source lang="javascript" line> | ||
f= file("/sdcard/myfile.txt") | f = file("/sdcard/myfile.txt") | ||
f.writeLine("one"); | |||
f.writeLine("two"); | |||
f.writeLine("three"); | |||
f.close(); | |||
var a = | var a = f.readLines(); | ||
</source> | </source> | ||
<ol> | <ol> | ||
<li>Open myfile.txt file on the sdcard. If the file does not exist, it is created.</li> | <li>Open myfile.txt file on the sdcard. If the file does not exist, it is created.</li> | ||
<li>Write the | <li>Write the string "one" as a line to the file</li> | ||
</ol> | </ol> | ||
<ol start="5"> | <ol start="5"> | ||
<li> | <li>Save and close the file</li> | ||
<li>Read the file | <li>Read all the lines of the file into the array a</li> | ||
</ol> | </ol> | ||