The C library function char fgets(char str, int n, FILE *stream) reads a line from the specified stream and stores it into the string pointed to by str. It stops when either (n-1) characters are read, the newline character is read, or the end-of-file is reached, whichever comes first.
I thought newline is equivalent to hitting enter on the keyboard. Is that correct? With this while loop it does not stop when I hit enter. I have to hit Ctrl-D or fill up the buffer to make it stop reading.