* Read line from stdin and write it to buf[], including terminating character. * * This can be faster than line = readln() because you can reuse * the buffer for each call. Note that reusing the buffer means that you * must copy the previous contents if you wish to retain them. * * Returns: * size_t 0 for end of file, otherwise number of characters read * Params: * buf = Buffer used to store the resulting line data. buf is resized as necessary. * terminator = Line terminator (by default, '\n'). Use std.ascii.newline * for portability (unless the file was opened in text mode). * Throws: * StdioException on I/O error, or UnicodeException on Unicode conversion error. * Example: * Reads stdin and writes it to stdout.

import std.stdio;

void main()
    char[] buf;
    while (readln(buf))
  1. S readln(dchar terminator)
  2. size_t readln(C[] buf, dchar terminator)
  3. size_t readln(C[] buf, R terminator)
    ref C[] buf
    if (
    is(Unqual!C == C)
    !is(C == enum)
    is(typeof(terminator.front == dchar.init))