reads a line of text from a file and returns it as a string.
reads a line of text from a stream and returns it as a string.
reads a line of text generated by an external process and returns it as a string.
- ReadLine reads until it encounters a newline, either "\n" or "\r\n".
- ReadLine[File["file"],…] is also supported.
- ReadLine["file",…] and ReadLine[File["file"],…] will first open "file" for reading if it is not already open. The file will be left open until it is closed by a call to Close.
- ReadLine is a blocking function that by default will not return until it has read a complete line of text.
- With the option setting TimeConstraint->t, ReadLine waits at most t seconds, then returns whatever it has read by that time.
- If ReadLine is called on a source of content that has already been exhausted, it returns EndOfFile.
- ReadLine[src] is equivalent to ReadString[src,"\n"|"\r\n"].
Introduced in 2014
(10.0)| Updated in 2016