Hello, everyone! I hope you can help me with this one...
What I want to do is create a console application that would process user input and then spawn other console applications in the same console window. So I write something like this:
The problem is, after the spawned process ends, the console stops receiving keyboard input (the output still works). I used to think that the child process closes the input handles when it finishes, but I realised that bInheritHandles parameter to CreateProcess() is set to FALSE, so that's not what causes the freeze. What can I do about it?
startupInfo.cb = sizeof(startupInfo);
printf("What do you do?\n" ); // Works OK
gets(userInput); // Freezes here!
printf("Got it!\n" );