I have two processes, first reading from stdin and writing to FIFO file, second is waiting for message from FIFO file.
I am using this program structure:
while(run)
{
fgets(string, sizeof(string), fp);
}
and when the sentinel (run) change to 0 to stop process, it didn't really stop because it stuck in fgets()
function.
How can I solve it?
I want program to waits for the message when sentinel change to 0 then immediately stop the program.