Reading input lines
Bill Lear
rael at see.sig.com
Mon Jan 22 16:58:02 PST 2007
I am trying to read lines from stdin and echo them to stdout.
I have come up with this:
import std.stdio;
import std.cstream;
import std.string;
void main () {
while (!din.eof()) {
char[] line = din.readLine();
if (line == null) continue;
writefln("%s", line);
}
}
but am confused why I would need to check for null. Is there
a better way to do this?
Bill
--
r * e * @ * o * y * a * c * m
* a * l * z * p * r * . * o *
More information about the Digitalmars-d
mailing list