[D Cookbook]about "Communicating with external processes" part.
xky via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sun Sep 13 07:42:54 PDT 2015
On Sunday, 13 September 2015 at 13:34:18 UTC, Adam D. Ruppe wrote:
> I'm in a super rush, running late to something else, but try
> using readln in the child before writing and see what happens.
> You sent data to it but the child never read it.
oh my... you're right. lol
so, i fix "pipe.d" this:
[ pipe.d ]
============================================================
import std.process;
import std.stdio;
void main(){
auto info = pipeProcess("child.exe");
scope(exit) wait(info.pid);
//info.stdin.writeln("data to send to the process");
foreach(line; info.stdout.byLine){
writeln("Result:", line);
}
}
============================================================
[ CMD ]
============================================================
C:\Users\user\Desktop\pipe>pipe
Result:hello
============================================================
work fine. thx so much. :)
More information about the Digitalmars-d-learn
mailing list