Hello,
I'm receiving strange results with reading stdin on Windows 7. Consider
this code:
module test;
import std.stdio;
void main(string[] args)
{
foreach (int i, string line; lines(stdin))
{
write(line);
}
}
On Linux, if I do 'cat test.d | ./test'
>>
Stanislav Blinov writes:
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Hello,
I'm receiving strange results with reading stdin on Windows 7. Consider
this code:
module test;
import std.stdio;
void main(string[] args)
{
foreach (int i, st
17.08.2010 14:41, Stanislav Blinov wrote:
write(line);
[snip]
writef(line);
[snip]
Sorry, both should be 'write'.
--
Stanislav Blinov Wrote:
> Hello,
>
> I'm receiving strange results with reading stdin on Windows 7. Consider
> this code:
>
> module test;
>
> import std.stdio;
>
> void main(string[] args)
> {
> foreach (int i, string line; lines(stdin))
> {
> write(line)
18.08.2010 17:54, Jesse Phillips wrote:
In my experience Windows hasn't gotten piping right. And it has been known to
have bugs, this might be related:
http://stackoverflow.com/questions/466801/python-piping-on-windows-why-does-this-not-work
Thanks, I'll take a look at that.
--
I get the same thing on XP.
If you swap the two like so:
type.exe | type.d
Then it works but it will wait on exit.
This works nicely:
type.exe < type.d
Joel Christensen Wrote:
> >>
> Stanislav Blinov writes:
> Content-Type: text/plain; charset=UTF-8; format=flowed
> Content-Transfer-Encodin
Oooops, I meant:
std.stdio.StdioException: Bad file descriptor
type test.d | test.exe
works, but waits on exit:
test.exe | type test.d
works fine:
test.exe < test.d
Andrej Mitrovic Wrote:
> I get the same thing on XP.
>
> If you swap the two like so:
> type.exe | type.d
>
> Then it works but
On 01-Sep-10 12:54 PM, Andrej Mitrovic wrote:
Oooops, I meant:
std.stdio.StdioException: Bad file descriptor
type test.d | test.exe
works, but waits on exit:
test.exe | type test.d
works fine:
test.exe< test.d
I think I get the same as you. Have to put Ctrl+C (or some thing) to get
out, for
I experience the exact same problem on Windows 7 64-bit.
> import std.stdio;
>
> int main() {
> char[] buf;
> while (stdin.readln(buf))
> write(buf);
> return 0;
> }
If compiled as "test.exe", running the following command:
> echo "test line 1" | test
Produces the following