According to the manpages, fgets writes a stream of characters to an array until it hits a null or newline character. But when I use fgets with a popen() stream with various shell commands, and then print the resulting array with printf, the newlines are retained and the output looks the same way as though I had gone through a terminal. Why is this?
Share
The
fgets(3)man page reads: