Write, Bureaucrats, Administrators
4,332
edits
mNo edit summary |
mNo edit summary |
||
Line 262: | Line 262: | ||
; getLineNumber : Get the current line number. | ; getLineNumber : Get the current line number. | ||
=== | === Examples === | ||
==== | ==== Writing & reading from a file ==== | ||
<source lang="javascript" line> | <source lang="javascript" line> | ||
f= file("/sdcard/myfile.txt") | f= file("/sdcard/myfile.txt") | ||
Line 272: | Line 273: | ||
var a = file.readLines(); | var a = file.readLines(); | ||
</source> | </source> | ||
<ol> | <ol> | ||
<li> | <li>Open myfile.txt file on the sdcard. If the file does not exist, it is created.</li> | ||
<li> | <li>Write the file into a string "one"</li> | ||
</ol> | </ol> | ||
<ol start="5"> | <ol start="5"> | ||
<li> | <li>Close the file, only then saved the file.</li> | ||
<li> | <li>Read the file from all the rows, the result is an array of strings to a.</li> | ||
</ol> | </ol> | ||
==== | ====Save a file to a record ==== | ||
Необходимо сохранить запись в формате xml. Запись имеет следующие поля: id , title , date. | Необходимо сохранить запись в формате xml. Запись имеет следующие поля: id , title , date. | ||
<source lang="javascript" line> | <source lang="javascript" line> |