On 06/25/2013 09:26 PM, lx wrote:

> Ctrl+z seems close the stream.So,if I want
> to input another batch of data,it became impossilbe.So,how to reopen the
> stream again to allow me to input another batch of data?

Making a copy of stdin works on Linux (where the stream is terminated by Ctrl-D in the console):

import std.stdio;
import std.algorithm;

void main()
{
    auto stdin_dup = stdin;

    stdin
        .byLine(KeepTerminator.yes)
        .copy(stdout.lockingTextWriter);

    writeln("done");

    stdin_dup
        .byLine(KeepTerminator.yes)
        .copy(stdout.lockingTextWriter);

    writeln("done again");
}

Ali

Reply via email to