Answer the question
In order to leave comments, you need to log in
How to read from stdout of another process in linux api?
There is the following code on WinApi:
std::string getResponseFromEngine(position)
{
WriteFile(pipin_w, position.c_str(), position.length(),&writ, NULL);
Sleep(500);
PeekNamedPipe(pipout_r, buffer,sizeof(buffer), &read, &available, NULL);
do
{
ZeroMemory(buffer, sizeof(buffer));
if(!ReadFile(pipout_r, buffer, sizeof(buffer), &read, NULL) || !read) break;
buffer[read] = 0;
str+=(char*)buffer;
}
while(read >= sizeof(buffer));
return str;
}
Answer the question
In order to leave comments, you need to log in
Capture the output of a child process in C
I think the same can be done for stdin.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question