while(GetExitCodeProcess(processInfo.hProcess, &exitCode)
&& exitCode == STILL_ACTIVE)
{
ReadFile(defaultSTDIN, chBuf, 1, &dwRead, 0);
WriteFile(writingEnd, chBuf, 1, &dwWritten, 0);
}
The problem with the code above is that even when the child process referenced through processInfo.hProcess has exited, we are still stuck in the while loop because ReadFile() is waiting for input. Whats the best way to solve this?