On this Page
fp.fgets
Read a line from a previously opened file.
Syntax
fp.fgets()
Parameters
None
Returned Value
Returns the next line of text in the file. null if at end of file.
Description
A previous call to _file.fopen must have been made. That fopen returns a new file pointer object fp. That object must then be used to call fgets. The file being read is expected to be encoded in UTF8.
Example
var fp = _file.fopen("myfile.txt", "r");// open for read
if (fp) {
var s = fp.fgets(); // read first line
_message("First line='%s'", s);
fp.fclose();
}