Thread overview | ||||||
---|---|---|---|---|---|---|
|
October 02, 2005 redirect input on windows | ||||
---|---|---|---|---|
| ||||
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
|
October 02, 2005 Re: redirect input on windows | ||||
---|---|---|---|---|
| ||||
Posted in reply to Carlos Santander Attachments: | 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
|
October 02, 2005 Re: redirect input on windows | ||||
---|---|---|---|---|
| ||||
Posted in reply to Thomas Kühne | Thomas Kühne escribió: > > 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 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 Bernal |
October 02, 2005 Re: redirect input on windows | ||||
---|---|---|---|---|
| ||||
Posted in reply to Carlos Santander | 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 |
Copyright © 1999-2021 by the D Language Foundation