if (kill(pid, 0) == 0) //Check if the process created is still running...
{
fputc(EOF, output); //If it was, tell it to stop with EOF
if (kill(pid, 0) == 0) //Check if the process created is still running...
{
fputc(EOF, output); //If it was, tell it to stop with EOF