readln() returns new line charater
Jakob Ovrum
jakobovrum at gmail.com
Sat Dec 28 09:15:16 PST 2013
On Saturday, 28 December 2013 at 16:59:51 UTC, bearophile wrote:
> void main() {
> import std.stdio, std.string;
> immutable txt = readln.chomp;
> writeln(">", txt, "<");
> }
>
>
> Bye,
> bearophile
These examples are cute, but I think in real programs it's
usually important to handle `stdin` being exhausted. With
`readln`, such code is prone to go into an infinite loop.
Of course in these same real programs, `byLine` is often the
better choice anyway...
More information about the Digitalmars-d
mailing list