Template parameter; the type of the allocated buffer, and the type returned. Defaults to string.
Line terminator (by default, '\n').
Note: String terminators are not supported due to ambiguity with readln(buf) below.
The line that was read, including the line terminator character.
StdioException on I/O error, or UnicodeException on Unicode conversion error.
// Reads `stdin` and writes it to `stdout`. import std.stdio; void main() { string line; while ((line = stdin.readln()) !is null) write(line); }
Read line from the file handle and return it as a specified type.
This version manages its own read buffer, which means one memory allocation per call. If you are not retaining a reference to the read data, consider the File.readln(buf) version, which may offer better performance as it can reuse its read buffer.