readln

fnS readln(S = string)(dchar terminator = '\n') if (isSomeString!S)
  • Read line from stdin.
  • 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 readln(buf) version, which may offer
  • better performance as it can reuse its read buffer.

    Returns

    The line that was read, including the line terminator character. *

    Parameters

fnsize_t readln(C)(ref C[] buf, dchar terminator = '\n') if (isSomeChar!C && is(Unqual!C == C) && !is(C == enum))
  • 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 *

    Parameters

fnsize_t readln(C, R)(ref C[] buf, R terminator) if (isSomeChar!C && is(Unqual!C == C) && !is(C == enum) && isBidirectionalRange!R && is(typeof(terminator.front == dchar.init)))

ditto