eof

lx zdhtlixin at 126.com
Wed Jun 26 06:50:52 PDT 2013


On Wednesday, 26 June 2013 at 13:45:41 UTC, lx wrote:
> 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 again after I enter ctrl-z .
  lx



More information about the Digitalmars-d-learn mailing list