Windows and piped stdin...?

alex alex at alexi.ch
Wed Feb 14 09:44:17 PST 2007


Hi,

Perhaps this is a common known problem, but I have really no idea what it could be.

Take this piece of code (say, main.d):

import std.stdio;
import std.cstream;

int main(char[][] args) {
	while (!din.eof()) {
		writefln("in: %s", din.readLine());
	}
  return 0;
}

This just reads from standard input and outputs until stdin ends.

It seems that Windows does never send an EOF when using like this:

do_some_output | main.exe

The output will never stop printing "in: "

The same program works fine under every flavor of Linux..... It is even working when using like this in Windows:

main.exe < some_input_file.txt

Some idea what this could be? Is it possible that Windows won't send a EOF on pipes....?

thanks

alex




More information about the Digitalmars-d mailing list