I like this question. It makes me remember the old time ...
Meta response: it only knows if the stream is closed
Answer: your process reads everything that it can / should read, endlessly on "\ n"
But I suppose you want to write / read notes.
Despite others, I try to respond without distinguishing between the types of threads. I am making a disclaimer:
it all depends on the OS and the type of stream - and opening options on both sides (!)
Basic:
Suppose that one process writes another reading - quite simply.
No no.
Imagine - always ;-) - they put strings (bytes) there in the stream as they want, and they can - slowly - quickly - one by one or all of them are buffered.
and you read it - no - not you, not your program - between them - byte by byte or on block or how you like the layer between them.
So, if you want a recording, there are only three possibilities:
- end char (byte) - block separator,
- make the recording length fixed
- old double byte length and then read the rest
Answer again:
in your case, the child puts all the characters in the stream that the parent reads, and above them - why does one of them take a break?
Decision:
Depending on the OS and language and libraries, you can sometimes specify the OS to make / accept the end of char (e.g. \ n) - sometimes your reading functions read this for you
halfbit
source share