On Wednesday, 26 June 2013 at 04:46:32 UTC, Ali Çehreli wrote:
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
Hi,Ali,I tried those codes,it doesn't work under win7.The result
is
"done again" will follow "done",without giving me any chance to
input.
lx