problems with DPL example.

Steven Schveighoffer schveiguy at yahoo.com
Wed Oct 12 08:38:24 PDT 2011


On Mon, 10 Oct 2011 15:42:26 -0400, simendsjo <simendsjo at gmail.com> wrote:

> On 10.10.2011 21:38, bearophile wrote:
>> %u:
>>
>>> D>echo hello | wordcount2.exe<  wordcount2.d
>>> 0       hello
>>> std.stdio.StdioException at std\stdio.d(2156): Bad file descriptor

This is a bug in the C runtime that D uses, where pipes are not used  
correctly.  I'm working on getting Walter to fix it as it's needed for the  
new std.process as well.

>>
>> Try:
>>
>> wordcount2.exe<  wordcount2.d
>>
>> Bye,
>> bearophile
>
> Shouldn't the original way work too?

Yes, but the main difference is, bearophile's method simply opens a file,  
which FILE * obviously supports no problem.  Your method creates a process  
with a pipe as the input.

-Steve


More information about the Digitalmars-d-learn mailing list