<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body bgcolor="#ffffff" text="#000000">
<tt>Hello,<br>
<br>
I'm receiving strange results with reading stdin on Windows 7.
Consider this code:<br>
<br>
</tt><tt>module test;<br>
<br>
import std.stdio;<br>
<br>
void main(string[] args)<br>
{<br>
foreach (int i, string line; lines(stdin))<br>
{<br>
write(line);<br>
}<br>
}<br>
</tt>
<br>
<tt>On Linux, if I do 'cat test.d | ./test' I get test.d contents on
stdout. But on Windows 7, ('type test.d | ./test.exe') the output
is this:</tt><br>
<tt><br>
std.stdio.StdioException: Bad file descriptor<br>
module test;<br>
<br>
import std.stdio;<br>
<br>
void main(string[] args)<br>
{<br>
foreach (int i, string line; lines(stdin))<br>
{<br>
writef(line);<br>
}<br>
}<br>
<br>
So I too get type.d contents on stdout, but preceeded by
StdioException string. This happens with dmd 2.047 and 2.048.<br>
<br>
Is this my error, dmd's, or Windows's piping?<br>
</tt>
<div class="moz-signature">-- <br>
<table style="border: 0px none; font-family: Segoe UI; font-size:
8pt;" width="100%">
<tbody>
<tr>
<td width="50%"><br>
</td>
<td><br>
</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>