Home > front end >  I'm electron spawn a C language program in the program as a child, how can I communicate with t
I'm electron spawn a C language program in the program as a child, how can I communicate with t

Time:10-04

C language code is:
 
#include
Int main () {
int i=0;
The scanf (" % d ", & amp; I);
Printf (" % d \ n ", I);
The scanf (" % d ", & amp; I);
Printf (" % d \ n ", I);
return 0;
}

I use sub_process. Stdin. Write (" 1 \ n "); Later, it will not immediately output;
When I use it twice program_process. Stdin. Write (" 1 \ n "); It will all output two 1;
But I hope to enter a program_process. Stdin. Write (" 1 \ n "); It's
Sub_process. Stdout. On (' data '(data)=& gt; {the console. The log (data); });
Will output a 1, as the program logic, but the reality is not, you only have two consecutive input 1, it can output two consecutive 1, this should be the problem of buffer transfer, I don't know exactly what is going on,

Some people say that to do so:
 
Sub_process. Stdin. Lawsuits ();
Sub_process. Stdin. Write (" 1 \ n ");
Sub_process. Stdin. Uncork ();


But I tried it on and I can't, or asynchronous:
 
Sub_process. Stdin. Lawsuits ();
Sub_process. Stdin. Write (" 1 \ n ", function () {sub_process. Stdin. Uncork (); });


They don't even output, output

Fast whole closed by the question,,,

  • Related