I use a pipe to send an int from father to child.
I write in father, and use read in child.
I thought that when i read from the pipe it becomes empty, so i do another read to wait for a second int.
The problem is that when i make the second read it picks up the int from the 1st message.
Am i making a mistake or is this behavior expected?
If so, can i empty the pipe so that the second read only reads when i write another int in the father?