readline([size])
Read one entire line from the file. A trailing newline character
is kept in the string (but may be absent when a file ends with an
incomplete line). If the size argument is present and
non-negative, it is a maximum byte count (including the trailing
newline) and an incomplete line may be returned. An empty string is
returned only when EOF is encountered immediately.
Note: Unlike stdio's fgets(), the
returned string contains null characters ('\0') if
they occurred in the input.
The advantage of leaving the newline on is that returning an empty string is then an unambiguous EOF indication. It is also possible (in cases where it might matter, for example, if you want to make an exact copy of a file while scanning its lines) to tell whether the last line of a file ended in a newline or not (yes this happens!).