How can I separate the lines which are coming from a pipe. In the pipe there is this text:
HALLO:500\\n
TEST:300\\N
ADAD
ADAWFFA
AFAGAGAEG
I wa
Here's another option (I am not totally sure it is a 'proper' way)- use the number of bytes read by the read
function.
In this example I was reading from stdin
although a redirection was made so the fd in 0 is a file/pipe/whatever you need it to be.
while ((nbytes=read(STDIN_FILENO, buffer, MAX_PIPE_SIZE)) > 0) {
write(STDOUT_FILENO, buffer, nbytes);
}