Input interrupt

Adam D. Ruppe via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun May 28 15:14:46 PDT 2017


On Sunday, 28 May 2017 at 22:07:12 UTC, helxi wrote:
> So I tried using C's EOF but the types aren't compatible since 
> EOF is probably aliased to -1


The readln docs for D say it returns null on end of file. The 
example given is:

import std.stdio;

void main()
{
     string line;
     while ((line = readln()) !is null)
         write(line);
}

http://dpldocs.info/experimental-docs/std.stdio.readln.1.html

I would try that.


More information about the Digitalmars-d-learn mailing list