digitalmars.D.learn - redirect input on windows
- Carlos Santander (9/9) Oct 01 2005 Does anybody know if there's a trick to make DMD-generated programs to r...
- =?ISO-8859-1?Q?Thomas_K=FChne?= (23/32) Oct 01 2005 -----BEGIN PGP SIGNED MESSAGE-----
- Carlos Santander (6/37) Oct 02 2005 Thanks, Thomas! That worked, but using din was enough. However, it's sti...
- Carlos Santander (4/10) Oct 02 2005 Nevermind, I found the problem: I was fflushing after some reads. Thanks...
Does anybody know if there's a trick to make DMD-generated programs to read from a redirected input on Windows? I mean: dmd foo foo < input I've been trying but I can't get it to work. I also get wrong (but different) behavior using dmc, visual c++ 2003 and lcc. However bcc, openwatcom and gcc work. Any ideas? -- Carlos Santander Bernal
Oct 01 2005
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Carlos Santander schrieb:Does anybody know if there's a trick to make DMD-generated programs to read from a redirected input on Windows? I mean: dmd foo foo < input I've been trying but I can't get it to work. I also get wrong (but different) behavior using dmc, visual c++ 2003 and lcc. However bcc, openwatcom and gcc work. Any ideas?** echo input lines ** import std.c.stdio; import std.stdio; import std.cstream; int main(){ CFile f = new CFile(stdin, FileMode.In, false); for(char c=f.getc(); c!=0xFF; c = f.getc()){ writef("%s", c); } return 0; } **** Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFDP38p3w+/yD4P9tIRAsE1AJ9aCPfEiRzva6NDCE5sRIxaBywxOACfV62u xPk3gcPpo0A39FwISV9fcV8= =1Lp4 -----END PGP SIGNATURE-----
Oct 01 2005
Thomas Kühne escribió:Carlos Santander schrieb:Thanks, Thomas! That worked, but using din was enough. However, it's still not working with C. What's so different with DMC, Visual C++ and LCC that that doesn't work? -- Carlos Santander BernalDoes anybody know if there's a trick to make DMD-generated programs to read from a redirected input on Windows? I mean: dmd foo foo < input I've been trying but I can't get it to work. I also get wrong (but different) behavior using dmc, visual c++ 2003 and lcc. However bcc, openwatcom and gcc work. Any ideas?** echo input lines ** import std.c.stdio; import std.stdio; import std.cstream; int main(){ CFile f = new CFile(stdin, FileMode.In, false); for(char c=f.getc(); c!=0xFF; c = f.getc()){ writef("%s", c); } return 0; } **** Thomas
Oct 02 2005
Carlos Santander escribió:Thanks, Thomas! That worked, but using din was enough. However, it's still not working with C. What's so different with DMC, Visual C++ and LCC that that doesn't work?Nevermind, I found the problem: I was fflushing after some reads. Thanks again. -- Carlos Santander Bernal
Oct 02 2005