Now, we come to the read-line function. For the C++ programmer, this is like std::getline. This function reads in the text stream until the next newline, if any, and returns the content in a string. It does no interpretation of the text beyond searching for the newline, and does not care about the syntax of the text contents. This is the function that you would be most likely to use when reading and scanning data files or natural language text.
The optional second argument, eof-error-p, defaults to true. Unless this argument is set to nil by the programmer, read-line will raise an error if it encounters the end of line. The optional third argument, eof-value, is that value that will be returned by read-line if the end of line is encountered before any other characters are read. A common construct, then, is to call read-line with the stream and then two nil arguments, causing it to return strings containing lines of text until none remain, when it returns nil instead of a string.
The read-line function returns a second value, nil if the line read was terminated by and end of line, and true if it was terminated by the end of the file. Using this, the programmer can determine whether or not the last line in the file has a trailing newline.