Input interrupt

helxi via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun May 28 15:25:55 PDT 2017


On Sunday, 28 May 2017 at 22:14:46 UTC, Adam D. Ruppe wrote:
> 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.

Oh yes, fantastic,
I also seem to have forgotten EOF was meant to compare chars, not 
strings.


More information about the Digitalmars-d-learn mailing list