www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Reading till the end of standard input

I am using dmd v2.032 and trying to read int values from the standard input:

import std.cstream;

void main()
    while (!din.eof()) {
        int value;

        if (!din.eof()) {
            dout.writefln("read: ", value);

1) If I

- start the program in bash under Linux
- enter a few values
- press Ctrl-D to end the input,

that program gets stuck in the loop; is this a bug? (I will open a bug if you

2) I know that there is no need to read past the end of the stream to put it
into EOF. Is that right? If so, the check within the while loop is unnecessary,

Thank you,
Sep 13 2009