How to send a command in a Process with C++?

  c++, c++11, c++17, windows

I have two application, first app is create a Process:

 if( !CreateProcess( myexe,   // No module name (use command line)
    NULL,        // Command line
    NULL,           // Process handle not inheritable
    NULL,           // Thread handle not inheritable
    FALSE,          // Set handle inheritance to FALSE
    0,              // No creation flags
    NULL,           // Use parent's environment block
    NULL,           // Use parent's starting directory 
    &si,            // Pointer to STARTUPINFO structure
    &pi )           // Pointer to PROCESS_INFORMATION structure
) 

process name is myexe.exe:

myexe waiting a input,

 #include <iostream>
using namespace std; 
int main()
{
    string value;

    while(true){
      cin>>value;
    }
}
     

How to send input value on cpp?

Source: Windows Questions

LEAVE A COMMENT